Skip to content

Commit e78911f

Browse files
authored
Merge pull request RobotLocomotion#180 from RobotLocomotion/pf-add-cross-scene-check
Add check to see if have cross-scene data
2 parents c6cb473 + c99a16a commit e78911f

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

dense_correspondence/evaluation/evaluation.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,21 @@ def evaluate_network_cross_scene(dcn=None, dataset=None, save=True):
276276
for annotated_pair in cross_scene_data:
277277

278278
scene_name_a = annotated_pair["image_a"]["scene_name"]
279-
scene_name_b = annotated_pair["image_b"]["scene_name"]
280-
279+
scene_name_b = annotated_pair["image_b"]["scene_name"]
280+
281+
if not os.path.isdir(dataset.get_full_path_for_scene(scene_name_a))\
282+
or not os.path.isdir(dataset.get_full_path_for_scene(scene_name_b)):
283+
print("at least one of these scene names does not exist:", scene_name_a, scene_name_b)
284+
continue
285+
print("these scene names both exist:", scene_name_a, scene_name_b)
286+
281287
image_a_idx = annotated_pair["image_a"]["image_idx"]
282288
image_b_idx = annotated_pair["image_b"]["image_idx"]
283289

284290
img_a_pixels = annotated_pair["image_a"]["pixels"]
285291
img_b_pixels = annotated_pair["image_b"]["pixels"]
286292

293+
287294
dataframe_list_temp =\
288295
DenseCorrespondenceEvaluation.single_cross_scene_image_pair_quantitative_analysis(dcn,
289296
dataset, scene_name_a, image_a_idx, scene_name_b, image_b_idx,
@@ -1538,8 +1545,14 @@ def evaluate_network_qualitative_cross_scene(dcn, dataset, draw_human_annotation
15381545
for annotated_pair in cross_scene_data:
15391546

15401547
scene_name_a = annotated_pair["image_a"]["scene_name"]
1541-
scene_name_b = annotated_pair["image_b"]["scene_name"]
1542-
1548+
scene_name_b = annotated_pair["image_b"]["scene_name"]
1549+
# some labeled cross scene data may not be in the configured dataset
1550+
# this checks that the scenes actually exist (i.e., have been downloaded)
1551+
if not os.path.isdir(dataset.get_full_path_for_scene(scene_name_a))\
1552+
or not os.path.isdir(dataset.get_full_path_for_scene(scene_name_b)):
1553+
print("at least one of these scene names does not exist:", scene_name_a, scene_name_b)
1554+
continue
1555+
print("these scene names exist:", scene_name_a, scene_name_b)
15431556
image_a_idx = annotated_pair["image_a"]["image_idx"]
15441557
image_b_idx = annotated_pair["image_b"]["image_idx"]
15451558

0 commit comments

Comments
 (0)