-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Add] Support VIS evaluation for YouTube-VIS task. #501
Conversation
Codecov Report
@@ Coverage Diff @@
## master #501 +/- ##
==========================================
- Coverage 73.35% 73.06% -0.30%
==========================================
Files 126 129 +3
Lines 7441 8055 +614
Branches 1395 1562 +167
==========================================
+ Hits 5458 5885 +427
- Misses 1555 1675 +120
- Partials 428 495 +67
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
I need to submit two JSON files for unit testing, but they can't pass Pre-commit. How should I solve this problem? |
The overall structure needs to be adjusted, we should try to reuse the current code and only add some necessary functions. Some suggestions are as the following:
|
for idx in instance_info: | ||
cur_video_len = len_video[instance_info[idx][0]['video_id']] | ||
len_videos[img_info['video_id']] = max(1, img_info['frame_id'] + 1) | ||
for ins_id in instance_infos: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last review has mentioned! Too many instance_infos[ins_id]
in this piece of code, we could set instance_infos = instances_infos[ins_id]
, and use instance_infos
rather than instance_infos[ins_id]
in the following code
bbox[frame_id[ann_info['image_id']]] = ann_info['bbox'] | ||
area[frame_id[ann_info['image_id']]] = ann_info['area'] | ||
for ann_info in instance_infos[ins_id]: | ||
segm[frame_id_mapping[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same problems as the above. Too many repeated use of dictionary indexes this piece of code.
frame_id = frame_id_mapping[ann_info['image_id']]
, and only use frame_id
below.
len_video[img_info['video_id']] = max(1, img_info['frame_id'] + 1) | ||
for idx in instance_info: | ||
cur_video_len = len_video[instance_info[idx][0]['video_id']] | ||
len_videos[img_info['video_id']] = max(1, img_info['frame_id'] + 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
len_videos[img_info['video_id']] = max(1, img_info['frame_id'] + 1) | |
video_id = img_info['video_id'] | |
len_videos[video_id] = len_videos.get(video_id, 0) + 1 |
instance_info = defaultdict(list) | ||
frame_id = defaultdict(list) | ||
len_video = defaultdict(list) | ||
instance_infos = defaultdict(list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecate the old code, we could use the coco api to realize this function as the following:
VIS = defaultdict(list)
the 'categories' and 'videos' has already loaded in this dataset, don't need to reload it.
for ins_id, img_ids in self.instancesToImgs.items():
instance_infos = []
for img_id in img_ids:
for ann in self.coco.imgToAnns[img_id]:
if ann['instance_id'] == instance_id:
add some code to load ann information of this instance
VIS['annotations'].append(instance_infos)
Deprecate the old code of VIS = defaultdict(list)
the 'categories' and 'videos' has already loaded in this dataset, don't need to reload `self.ann_file`.
for ins_id, img_ids in self.coco.instancesToImgs.items():
instance_infos = []
for img_id in img_ids:
for ann in self.coco.imgToAnns[img_id]:
if ann['instance_id'] == instance_id:
add some code to load ann information of this instance
VIS['annotations'].append(instance_infos) Please check the above pseudo-code to make it run rightly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for removing the request review
tag.
update youtube_vis
There are three main modifications here.
mmtrack/core/evaluation/eval_vis.py
width
andheight
info to the key ofvideo
.evaluate
inmmtrack/datasets/youtube_vis_dataset.py
.For the first part, the JSON format used for training is converted into the native JSON format of YouTube-VIS for calculation.