-
Notifications
You must be signed in to change notification settings - Fork 48
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 finetune single_class_dataset #351
Conversation
@@ -5,18 +5,17 @@ | |||
start_num = 1 | |||
|
|||
# 获取当前目录下所有的.txt文件 | |||
files = [f for f in os.listdir('images/train') if f.endswith(extension)] | |||
files = [f for f in os.listdir('images/val') if f.endswith(extension)] |
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.
为啥要换这个
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.
只需要对验证集做改名和生成json文件,这里怕误导用户
@@ -82,4 +82,3 @@ def init_coco_format(): | |||
# 为每个分区保存JSON文件 | |||
with open(f"./annotations/instances_val2017.json", "w") as json_file: | |||
json.dump(coco_format, json_file, indent=4) | |||
|
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.
空行
@@ -43,7 +42,7 @@ def xml2txt(xml, labels, name_list, img_path): | |||
fil_name = root.find('filename').text[:-4] | |||
if not os.path.exists(labels): # 如果路径不存在则创建 | |||
os.mkdir(labels) | |||
out = open(labels + './' + fil_name + '.txt', 'w+') | |||
out = open(labels + '/' + fil_name + '.txt', 'w+') |
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.
可以换成 os.path.join(path1, path2)的方式
|
||
for i, file in enumerate(files, start=start_num): | ||
# 构造新的文件名,使用zfill填充前导零 | ||
new_filename = f"{i:06d}{extension}" | ||
|
||
# 使用os.rename重命名文件 | ||
# 需根据自己的路径修改 | ||
os.chdir('D:/Desktop/mindspore/yolo_car_detection/bddua/bdd100k/images/train') | ||
os.chdir('D:/Desktop/mindspore/yolo_car_detection/bddua/bdd100k/images/val') |
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.
这个搞成入参吧,代码里硬编码不好
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.
已修改为相对路径,并在readme中说明应在数据集的根目录下使用
e422565
to
d0bd2ff
Compare
Thank you for your contribution to the MindYOLO repo.
Before submitting this PR, please make sure:
Motivation
(Write your motivation for proposed changes here.)
Test Plan
(How should this PR be tested? Do you require special setup to run the test or repro the fixed bug?)
Related Issues and PRs
(Is this PR part of a group of changes? Link the other relevant PRs and Issues here. Use https://help.github.com/en/articles/closing-issues-using-keywords for help on GitHub syntax)