Skip to content
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

Refactor ava hook #567

Merged
merged 34 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c5f00a8
resolve comments
Oct 16, 2020
05575c1
update changelog
Oct 16, 2020
eb09070
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Oct 19, 2020
81302a4
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Oct 22, 2020
43a649a
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Oct 27, 2020
755809e
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Oct 29, 2020
d478c9d
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Nov 2, 2020
08bbc06
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Nov 7, 2020
ff958e6
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Nov 8, 2020
d0e192d
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Nov 11, 2020
a52c536
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Nov 11, 2020
81a2029
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Nov 16, 2020
e03d2a9
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Nov 17, 2020
2a9b57f
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Nov 27, 2020
28001ff
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Nov 30, 2020
46cc5dd
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Dec 1, 2020
667818a
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Dec 18, 2020
34398a8
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Dec 18, 2020
9928127
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Jan 5, 2021
b633443
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Jan 5, 2021
a891176
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
Jan 5, 2021
611ae31
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
kennymckormick Jan 13, 2021
96662d4
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
kennymckormick Jan 15, 2021
ef5ab3c
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
kennymckormick Jan 25, 2021
0b63bd0
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
kennymckormick Jan 27, 2021
584e57f
Refactor AVA Eval, only support mAP
kennymckormick Jan 27, 2021
e032731
fix unittest
kennymckormick Jan 27, 2021
879d920
add warning
kennymckormick Jan 27, 2021
d4450fc
Merge branch 'master' of https://github.com/open-mmlab/mmaction2
kennymckormick Jan 27, 2021
dd964e8
Refactor AVA Eval, only support mAP
kennymckormick Jan 27, 2021
8c842ae
fix unittest
kennymckormick Jan 27, 2021
e55a3be
add warning
kennymckormick Jan 27, 2021
adcdc23
Merge branch 'RefactorAVAHook' of github.com:kennymckormick/mmaction2…
kennymckormick Jan 27, 2021
3a4f68d
update warning info
kennymckormick Jan 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/detection/ava/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ python tools/test.py ${CONFIG_FILE} ${CHECKPOINT_FILE} [optional arguments]
Example: test SlowOnly model on AVA and dump the result to a csv file.

```shell
python tools/test.py configs/detection/AVA/slowonly_kinetics_pretrained_r50_8x8x1_20e_ava_rgb.py checkpoints/SOME_CHECKPOINT.pth --eval bbox --out results.csv
python tools/test.py configs/detection/AVA/slowonly_kinetics_pretrained_r50_8x8x1_20e_ava_rgb.py checkpoints/SOME_CHECKPOINT.pth --eval mAP --out results.csv
```

For more details and optional arguments infos, you can refer to **Test a dataset** part in [getting_started](/docs/getting_started.md#test-a-dataset) .
4 changes: 2 additions & 2 deletions mmaction/core/evaluation/ava_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def ava_eval(result_file,
max_dets=(100, ),
verbose=True):

assert result_type in ['proposal', 'bbox']
assert result_type in ['mAP']

start = time.time()
categories, class_whitelist = read_labelmap(open(label_file))
Expand Down Expand Up @@ -213,7 +213,7 @@ def ava_eval(result_file,
ret[f'AR@{num}'] = ar[i]
return ret

if result_type == 'bbox':
if result_type == 'mAP':
pascal_evaluator = det_eval.PascalDetectionEvaluator(categories)

start = time.time()
Expand Down
6 changes: 5 additions & 1 deletion mmaction/datasets/ava_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,14 @@ def dump_results(self, results, out):

def evaluate(self,
results,
metrics=('proposal', 'bbox'),
metrics=('mAP', ),
metric_options=None,
logger=None):
# need to create a temp result file
assert len(metrics) == 1 and metrics[0] == 'mAP', (
'For evaluation on AVADataset, you need to use metrics "mAP" '
'See https://github.com/open-mmlab/mmaction2/pull/567 '
'for more info.')
time_now = datetime.now().strftime('%Y%m%d_%H%M%S')
temp_file = f'AVA_{time_now}_result.csv'
results2csv(self, results, temp_file)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_data/test_datasets/test_ava_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,4 @@ def test_ava_evaluate(self):
[0.106, 0.445, 0.782, 0.673, 0.367]])
]]
res = ava_dataset.evaluate(fake_result)
assert_array_almost_equal(res['Recall@0.5@100'], 0.33333333)
assert_array_almost_equal(res['AR@100'], 0.15833333)
assert_array_almost_equal(res['mAP@0.5IOU'], 0.027777778)
7 changes: 1 addition & 6 deletions tests/test_metrics/test_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,8 @@ def test_ava_detection():
result_path = osp.join(data_prefix, 'pred.csv')
label_map = osp.join(data_prefix, 'action_list.txt')

# eval proposal
detection = ava_eval(result_path, 'proposal', label_map, gt_path, None)
assert_array_almost_equal(detection['Recall@0.5@100'], 0.41666667)
assert_array_almost_equal(detection['AR@100'], 0.08333333)

# eval bbox
detection = ava_eval(result_path, 'bbox', label_map, gt_path, None)
detection = ava_eval(result_path, 'mAP', label_map, gt_path, None)
assert_array_almost_equal(detection['mAP@0.5IOU'], 0.09385522)


Expand Down