Commit 45178d3d authored by Ameya Shringi's avatar Ameya Shringi
Browse files

Minor changes to roidb generation

* Remove video number from video path. New video path format is frame_root/video_name

* check chunk id before loading chunk.json
parent 07d46ee0
......@@ -18,10 +18,11 @@ def generate_testing_video_db(json_index_path, chunk_file, chunk_id):
use_chunks = False
with open(json_index_path, 'r') as f:
all_annotations = json.load(f)
with open(chunk_file, 'r') as f:
all_chunks = json.load(f)
if chunk_id > 0:
use_chunks = True
if chunk_id > 0:
use_chunks = True
with open(chunk_file, 'r') as f:
all_chunks = json.load(f)
chunk_key = "Chunk" + str(chunk_id)
if chunk_key in all_chunks.keys():
chunk_videos = all_chunks[chunk_key]["files"]
......@@ -47,7 +48,7 @@ def generate_testing_video_db(json_index_path, chunk_file, chunk_id):
for index in range(len(start_indices)):
start_index = start_indices[index]
end_index = end_indices[index]
video_prefix = video_name.split(".")[0]
video_prefix = os.path.splitext(video_name)[0]
if video_prefix not in video_db.keys():
video_db[video_prefix] = [[start_index, end_index, -1]]
else:
......@@ -198,7 +199,7 @@ def generate_roidb_pkl(test_mode, kpf_mode,
video_db = generate_density_training_video_db(annotation_dirs, classes)
for video in video_db:
video_folder = os.path.join(frames_root, get_relative_path(video))
video_folder = os.path.join(frames_root, video)
if not os.path.exists(video_folder):
print ("Skipping video, could not find its folder : " + video_folder)
sys.exit()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment