princetonvisualai / revise-tool

REVISE: A Tool for Measuring and Mitigating Bias in Visual Datasets --- https://arxiv.org/abs/2004.07999
MIT License
111 stars 19 forks source link

Object Analysis for Coco Dataset (M7): "ValueError: zero-dimensional arrays cannot be concatenated" #11

Closed Handam1 closed 3 years ago

Handam1 commented 3 years ago

Hi,

when trying to run the Object Analysis notebook on the Coco dataset I am getting the following error in the "Analyses" section of "(M7) Metric: Size and Distance from Center of Supercategories":

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-38-6ffb36b669b2> in <module>
      1 if first_pass:
----> 2     object_size(cat_to_ent[0][1], None)
      3 ui = HBox(all_things)
      4 out = widgets.interactive_output(object_size, {'object_class': object_class_widget, 'sizes': sizes_widget})
      5 display(ui, out)

<ipython-input-37-46aecec2feb8> in object_size(object_class, sizes)
    144     these_instances = np.concatenate(instances_per, axis=0)
    145     scenes_per = np.array([dataset.from_path(filepath)[1][4] for filepath in filepaths])
--> 146     these_scenes = np.concatenate(scenes_per, axis=0)
    147     num, counts = np.unique(these_instances, return_counts=True)
    148     num = np.array([categories.index(nu) for nu in num])

<__array_function__ internals> in concatenate(*args, **kwargs)

ValueError: zero-dimensional arrays cannot be concatenated

<Figure size 432x288 with 0 Axes>

The issue is, that the variable scenes_per is simply a list of None's:

[None None None None None None None None None None None None None None
 None None None None None None None None None None None None None None
 None None None None None None None None None None None]

printing dataset.from_path(filepath)[1] for one filepath in filepaths results in:

[[{'bbox': [0.23233333333333334, 0.999, 0.22865625, 1.0], 'label': 1}, {'bbox': [0.28827083333333337, 0.6980625, 0.6325000000000001, 0.88925], 'label': 88}, {'bbox': [0.003, 0.23970833333333333, 0.9039375, 0.987078125], 'label': 65}], [1, [0.23233333333333334, 0.999, 0.22865625, 1.0]], [0], '/n/fs/visualai-scr/Data/Coco/2014data/train2014/COCO_train2014_000000176176.jpg', None]

I verified, that the image at the given path exists. Can anyone help me with this issue? Thanks in advance!

Best regards, Tobias

Angelina-Wang commented 3 years ago

Hi Tobias! We've recently pushed a change (with description in step .5 of README) that should solve this.

The actions you should take are: pulling the latest version of the code, downloading the file "coco_scene_mapping.pkl" from here and putting it into the same space as the other pickle files you downloaded, and trying again. Please let me know if this does not fix it.