Пример #1
0
    # - Estimation " " with respect to the BBox - ignoring them from the calculation

    # Set useful directories
    frames_dir = os.path.join(w.ROOT_DIR, 'frames')
    results_dir = os.path.join(w.OUTPUT_DIR, 'week2', 'task2', EXP_NAME)
    # Ground truth file path
    gt_file = os.path.join(w.ROOT_DIR, 'datasets', 'AICity_data', 'train',
                           'S03', 'c010', 'gt', 'gt.txt')

    # Create folders if they don't exist
    if not os.path.isdir(results_dir):
        os.mkdir(results_dir)

    # Get file paths for each of the frames and sort them according
    # to the frame number
    frame_paths = ut.get_files_from_dir2(frames_dir, ext='.jpg')
    frame_paths.sort(key=ut.natural_keys)

    # Total number of frames
    num_frames = len(frame_paths)

    # Flag to show the results based on image dimension
    color_flag = cv.IMREAD_GRAYSCALE if DIM <= 1 else cv.IMREAD_COLOR

    # Get the the images for training
    num_frames_test = int(num_frames * N)

    # Separate frames for training and testing
    train_frames = frame_paths[:num_frames_test]
    test_frames = frame_paths[num_frames_test:]
Пример #2
0
# For visulization
import matplotlib.pyplot as plt
import matplotlib.patches as patches

"""
task 1
1 Gaussian Background model
Estimating on 25% of the video frame
- Estimation of the background without consideration of the foreground in the gt.txt
- Estimation " " with respect to the BBox - ignoring them from the calculation
'
"""
frames_dir = '../frames'
gt_file = '../datasets/AICity_data/train/S03/c010/gt/gt.txt'
frame_list = ut.get_files_from_dir2(frames_dir,ext = '.jpg')
frame_list.sort(key=ut.natural_keys)

output_dir = '../week2_results/'
output_subdir = 'BG_1G/'
exp_name = 'BG1G_noGT'

if not os.path.isdir(output_dir+output_subdir):
    os.mkdir(output_dir+output_subdir)
#frame_list = ut.get_files_from_dir(frames_dir, excl_ext='jpg')
#print frame_list
# training
N =len(frame_list)
d =1
COLOR_SPACE = None #cv.COLOR_BGR2HSV
COLOR_CHANNELS = [] #[0,1]