Skip to content

Commit

Permalink
Merge pull request #180 from RobotLocomotion/pf-add-cross-scene-check
Browse files Browse the repository at this point in the history
Add check to see if have cross-scene data
  • Loading branch information
manuelli authored May 7, 2019
2 parents c6cb473 + c99a16a commit e78911f
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions dense_correspondence/evaluation/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,21 @@ def evaluate_network_cross_scene(dcn=None, dataset=None, save=True):
for annotated_pair in cross_scene_data:

scene_name_a = annotated_pair["image_a"]["scene_name"]
scene_name_b = annotated_pair["image_b"]["scene_name"]

scene_name_b = annotated_pair["image_b"]["scene_name"]

if not os.path.isdir(dataset.get_full_path_for_scene(scene_name_a))\
or not os.path.isdir(dataset.get_full_path_for_scene(scene_name_b)):
print("at least one of these scene names does not exist:", scene_name_a, scene_name_b)
continue
print("these scene names both exist:", scene_name_a, scene_name_b)

image_a_idx = annotated_pair["image_a"]["image_idx"]
image_b_idx = annotated_pair["image_b"]["image_idx"]

img_a_pixels = annotated_pair["image_a"]["pixels"]
img_b_pixels = annotated_pair["image_b"]["pixels"]


dataframe_list_temp =\
DenseCorrespondenceEvaluation.single_cross_scene_image_pair_quantitative_analysis(dcn,
dataset, scene_name_a, image_a_idx, scene_name_b, image_b_idx,
Expand Down Expand Up @@ -1538,8 +1545,14 @@ def evaluate_network_qualitative_cross_scene(dcn, dataset, draw_human_annotation
for annotated_pair in cross_scene_data:

scene_name_a = annotated_pair["image_a"]["scene_name"]
scene_name_b = annotated_pair["image_b"]["scene_name"]

scene_name_b = annotated_pair["image_b"]["scene_name"]
# some labeled cross scene data may not be in the configured dataset
# this checks that the scenes actually exist (i.e., have been downloaded)
if not os.path.isdir(dataset.get_full_path_for_scene(scene_name_a))\
or not os.path.isdir(dataset.get_full_path_for_scene(scene_name_b)):
print("at least one of these scene names does not exist:", scene_name_a, scene_name_b)
continue
print("these scene names exist:", scene_name_a, scene_name_b)
image_a_idx = annotated_pair["image_a"]["image_idx"]
image_b_idx = annotated_pair["image_b"]["image_idx"]

Expand Down

0 comments on commit e78911f

Please sign in to comment.