Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

make hmdb train/val list generation more robust #811

Merged
merged 1 commit into from
Apr 19, 2021

Conversation

dreamerlin
Copy link
Collaborator

No description provided.

@dreamerlin dreamerlin linked an issue Apr 14, 2021 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Apr 14, 2021

Codecov Report

Merging #811 (beb12a6) into master (36271bb) will increase coverage by 0.02%.
The diff coverage is n/a.

❗ Current head beb12a6 differs from pull request most recent head b00fd22. Consider uploading reports for the commit b00fd22 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #811      +/-   ##
==========================================
+ Coverage   84.88%   84.90%   +0.02%     
==========================================
  Files         131      131              
  Lines        9394     9394              
  Branches     1605     1605              
==========================================
+ Hits         7974     7976       +2     
+ Misses       1013     1012       -1     
+ Partials      407      406       -1     
Flag Coverage Δ
unittests 84.90% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmaction/datasets/pipelines/augmentations.py 93.24% <0.00%> (+0.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36271bb...b00fd22. Read the comment docs.

@kennymckormick
Copy link
Member

Perhaps I didn't get it. Why the old codes are less robust and how this PR is related to Issue #808. Can you add some explanation to help me understand it?

@dreamerlin
Copy link
Collaborator Author

@kennymckormick If 'data/hmdb51/annotations/classInd.txt' is generated once and data/hmdb51/annotations/trainlist{:02d}.txt / data/hmdb51/annotations/testlist{:02d}.txt happen to be lost (program crash, file transmisson, etc). These two lines will not be go through.

if not osp.exists(class_index_file):
generate_class_index_file()

which may cause the failure of generating data/hmdb51/annotations/trainlist{:02d}.txt / data/hmdb51/annotations/testlist{:02d}.txt

Comment on lines +433 to +449
if not osp.exists(class_index_file):
with open(class_index_file, 'w') as f:
content = []
for class_id, class_name in enumerate(class_list):
# like `ClassInd.txt` in UCF-101,
# the class_id begins with 1
class_dict[class_name] = class_id + 1
cur_line = ' '.join([str(class_id + 1), class_name])
content.append(cur_line)
content = '\n'.join(content)
f.write(content)
else:
print(f'{class_index_file} has been generated before.')
class_dict = {
class_name: class_id + 1
for class_id, class_name in enumerate(class_list)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can define class_dict first and once

class_dict = {
    class_name: class_id + 1
    for class_id, class_name in enumerate(class_list)
}
if not osp.exists(class_index_file):
    ...
else:
    ...

@congee524
Copy link
Contributor

Maybe it's caused by other problems. We can keep the original issue #808 first

@kennymckormick
Copy link
Member

@kennymckormick If 'data/hmdb51/annotations/classInd.txt' is generated once and data/hmdb51/annotations/trainlist{:02d}.txt / data/hmdb51/annotations/testlist{:02d}.txt happen to be lost (program crash, file transmisson, etc). These two lines will not be go through.

if not osp.exists(class_index_file):
generate_class_index_file()

which may cause the failure of generating data/hmdb51/annotations/trainlist{:02d}.txt / data/hmdb51/annotations/testlist{:02d}.txt

got it

@innerlee innerlee merged commit d1f5b9e into open-mmlab:master Apr 19, 2021
@dreamerlin dreamerlin linked an issue Apr 19, 2021 that may be closed by this pull request
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hmdb51数据集生成帧文件列表时
4 participants