sequence = os.path.splitext(sequence_txt)[0]    #MOT16-01
        sequence_dir = os.path.join(args.mot_dir, sequence)
        #with open(sequence_txt, 'r') as track:
        #    track_id = [int(l.split(',')[1]) for l in f_hi.read().splitlines()[:]]
        
        if not os.path.exists(sequence_dir):
            continue
        result_file = os.path.join(args.result_dir, sequence_txt)
        update_ms = args.update_ms

        video_filename = os.path.join(args.output_dir, "%s_ID%s_tracking.avi" % (sequence, IDnum))
#        video_filename = os.path.join(args.output_dir, "%s_ID%s_foot_10.avi" % (sequence, IDnum))

        print("Saving %s to %s." % (sequence_txt, video_filename))
        
        show_results.run(
            sequence_dir, result_file, False, None, update_ms, video_filename, IDnum)



    if not args.convert_h264:
        import sys
        sys.exit()

    for sequence_txt in os.listdir(args.result_dir):
        sequence = os.path.splitext(sequence_txt)[0]
        sequence_dir = os.path.join(args.mot_dir, sequence)
        if not os.path.exists(sequence_dir):
            continue
        filename_in = os.path.join(args.output_dir, "%s.avi" % sequence)
        filename_out = os.path.join(args.output_dir, "%s.mp4" % sequence)
        convert(filename_in, filename_out)
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program.  If not, see <http://www.gnu.org/licenses/>.

__author__ = "Miquel Ferrarons, David Vazquez"
__copyright__ = "Copyright 2015, CVC-UAB"
__credits__ = ["Miquel Ferrarons", "David Vazquez"]
__license__ = "GPL"
__version__ = "1.0"
__maintainer__ = "Miquel Ferrarons"

import extract_features
import train_model
import test_image
import test_folder
import show_results
import evaluate_results

extract_features.run() #Extracts the features for all the images
train_model.run() #Train the classifier

#Tests a single image and shows the results
#test_image.run()

#Test a whole folder
test_folder.run()
show_results.run() #Saves the resulting images
evaluate_results.run()# Runs the evaluation
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

__author__ = "Miquel Ferrarons, David Vazquez"
__copyright__ = "Copyright 2015, CVC-UAB"
__credits__ = ["Miquel Ferrarons", "David Vazquez"]
__license__ = "GPL"
__version__ = "1.0"
__maintainer__ = "Miquel Ferrarons"

import extract_features
import train_model
import test_image
import test_folder
import show_results
import evaluate_results

extract_features.run()  # Extracts the features for all the images
train_model.run()  # Train the classifier

# Tests a single image and shows the results
# test_image.run()

# Test a whole folder
test_folder.run()
show_results.run()  # Saves the resulting images
evaluate_results.run()  # Runs the evaluation

if __name__ == "__main__":
    args = parse_args()

    os.makedirs(args.output_dir, exist_ok=True)
    for sequence_txt in os.listdir(args.result_dir):
        sequence = os.path.splitext(sequence_txt)[0]
        sequence_dir = os.path.join(args.mot_dir, sequence)
        if not os.path.exists(sequence_dir):
            continue
        result_file = os.path.join(args.result_dir, sequence_txt)
        update_ms = args.update_ms
        video_filename = os.path.join(args.output_dir, "%s.avi" % sequence)

        print("Saving %s to %s." % (sequence_txt, video_filename))
        show_results.run(
            sequence_dir, result_file, False, None, update_ms, video_filename)

    if not args.convert_h264:
        import sys
        sys.exit()
    for sequence_txt in os.listdir(args.result_dir):
        sequence = os.path.splitext(sequence_txt)[0]
        sequence_dir = os.path.join(args.mot_dir, sequence)
        if not os.path.exists(sequence_dir):
            continue
        filename_in = os.path.join(args.output_dir, "%s.avi" % sequence)
        filename_out = os.path.join(args.output_dir, "%s.mp4" % sequence)
        convert(filename_in, filename_out)
Example #5
0
    args = parse_args()

    os.makedirs(args.output_dir, exist_ok=True)
    for sequence_txt in os.listdir(args.result_dir):
        if not sequence_txt.endswith(".txt"):
            continue
        sequence = os.path.splitext(sequence_txt)[0]
        sequence_dir = os.path.join(args.mot_dir, sequence)
        if not os.path.exists(sequence_dir):
            continue
        result_file = os.path.join(args.result_dir, sequence_txt)
        update_ms = args.update_ms
        video_filename = os.path.join(args.output_dir, "%s.avi" % sequence)

        print("Saving %s to %s." % (sequence_txt, video_filename))
        show_results.run(sequence_dir, result_file, False, None,
                         int(update_ms), video_filename)

    if not args.convert_h264:
        import sys
        sys.exit()
    for sequence_txt in os.listdir(args.result_dir):
        if not sequence_txt.endswith(".txt"):
            continue
        sequence = os.path.splitext(sequence_txt)[0]
        sequence_dir = os.path.join(args.mot_dir, sequence)
        if not os.path.exists(sequence_dir):
            continue
        filename_in = os.path.join(args.output_dir, "%s.avi" % sequence)
        filename_out = os.path.join(args.output_dir, "%s.mp4" % sequence)
        convert(filename_in, filename_out)
        os.remove(filename_in)