Closed yjcreation closed 1 year ago
您好,将train2017.1@1.txt填入Dataset下的train,将train2017.1@1-unlabeled.txt填入Dataset下的target,以此类推
您好,将train2017.1@1.txt填入Dataset下的train,将train2017.1@1-unlabeled.txt填入Dataset下的target,以此类推
感谢!还有一些问题向您请教,紧接着我根据readme.md文件中,直接进行半监督训练
,进行了如下操作:
1.在配置文件configs/ssod/custom/yolov5l_custom_ssod.yaml
中加载了事先在yolov5上训练好的权重,并修改了如下内容:
weights: '/home/cv/yy/5.semi-object/efficientteacher-main/weights/train_yolov5/best.pt'
Model: depth_multiple: 0.33 # 1.00 # model depth multiple width_multiple: 0.50 # 1.00 # layer channel multiple
Dataset: data_name: 'coco' train: /home/cv/yy/5.semi-object/efficientteacher-main/datasets/coco/semi/train2017.1@50.txt # data/custom_train.txt # 118287 images val: /home/cv/yy/5.semi-object/efficientteacher-main/datasets/coco/val2017.txt # data/custom_val.txt # 5000 images test: /home/cv/yy/5.semi-object/efficientteacher-main/datasets/coco/val2017.txt # data/custom_val.txt # 20288 of 40670 images, submit to https://competitions.codalab.org/competitions/20794^ target: /home/cv/yy/5.semi-object/efficientteacher-main/datasets/coco/semi/train2017.1@50-unlabeled.txt nc: 7 # 2 # number of classes np: 0 #number of keypoints names: ['gram', 'pseudogram', 'moni', 'glyc', 'gloeo', 'clavi', 'anth'] img_size: 640 batch_size: 16
2.然后开始训练,遇到如下问题:
EfficientTeacher 2023-3-2 torch 1.11.0 CUDA:0 (NVIDIA GeForce RTX 3090, 24245.8125MB)
Weights & Biases: run "pip install wandb" to automatically track and visualize EfficientTeacher runs (RECOMMENDED)
TensorBoard: Start with "tensorboard --logdir yolov5_ssod", view at http://localhost:6006/
Traceback (most recent call last):
File "train.py", line 84, in <module>
main(opt)
File "train.py", line 72, in main
trainer = SSODTrainer(cfg, device, callbacks, LOCAL_RANK, RANK, WORLD_SIZE)
File "/home/cv/yy/5.semi-object/efficientteacher-main/trainer/ssod_trainer.py", line 58, in __init__
self.build_model(cfg, device)
File "/home/cv/yy/5.semi-object/efficientteacher-main/trainer/ssod_trainer.py", line 103, in build_model
ckpt = torch.load(weights, map_location=device) # load checkpoint
File "/home/cv/.conda/envs/yolox/lib/python3.8/site-packages/torch/serialization.py", line 712, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "/home/cv/.conda/envs/yolox/lib/python3.8/site-packages/torch/serialization.py", line 1046, in _load
result = unpickler.load()
File "/home/cv/.conda/envs/yolox/lib/python3.8/site-packages/torch/serialization.py", line 1039, in find_class
return super().find_class(mod_name, name)
ModuleNotFoundError: No module named "models.yolo"
为什么会找不到呢,将其修改为from scripts.mula_convertor.models.yolo import Detect, Model
依然出现该问题?运行python train.py
是在efficientteacher-main
项目目录下:/home/cv/yy/5.semi-object/efficientteacher-main
(2)是不是应该首先通过convert_pt_to_efficient.py进行转化呢?使用该脚本,遇到错误
Traceback (most recent call last):
File "scripts/mula_convertor/convert_pt_to_efficient.py", line 92, in <module>
convert_yolov5_to_efficient( '/home/cv/yj/5.semi-object/efficientteacher-main/weights/train_yolov5/best.pt', '/home/cv/yj/5.semi-object/efficientteacher-main/configs/ssod/custom/yolov5s_spore_ssod.yaml','/home/cv/yj/5.semi-object/efficientteacher-main/efficient-yolov5s.pt')
File "scripts/mula_convertor/convert_pt_to_efficient.py", line 16, in convert_yolov5_to_efficient
with open(map_path, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'map.txt'
请问map.txt是什么文件
3.readme文件中说默认的半监督训练方案是先训220epoch的有监督,然后进入半监督。配置文件configs/ssod/custom/yolov5l_custom_ssod.yaml
中epoch设置的是20,请问这个20起作用了吗
@BowieHsu
@yjcreation 1.您好,根据log, 问题出在yaml里的这一行 weights: '/home/cv/yy/5.semi-object/efficientteacher-main/weights/train_yolov5/best.pt',您这个pt应该是用原生YOLOv5代码训练出来的,请使用我们提供的转换脚本转成我们的格式,再加载就不会报这个错 2.转换脚本下面的map是用来替换state_dict中的模块名,因为原生YOLOv5代码是使用yaml来定义网络结构,而我们的代码是使用backbone/neck/head来定义网络结构的,所以需要使用一个脚本来替换state_dict中的前缀,这个过程不会对权重进行修改,只是换掉了索引名 3.custom中的epoch 20的意思是总共进行20轮训练,而有监督轮次的控制参数为burn_in_epoch,这里设置多少就会先进行多少次有监督训练,然后进行(epoch - burn_in_epoch)次的半监督训练
FileNotFoundError: [Errno 2] No such file or directory: 'map.txt'
非常感谢!您好!针对问题2,FileNotFoundError: [Errno 2] No such file or directory: 'map.txt'
必须在这个目录下运行吗?
在指定cfg_path
参数的时候必须指定yolov5l_custom.yaml
配置文件(该配置文件中没有半监督的参数),而不能直接指定yolov5l_custom_ssod.yaml
配置文件吗?如果指定yolov5l_custom_ssod.yaml
配置文件,则会出现如下错误:
File "/home/cv/.conda/envs/yolox/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/cv/.conda/envs/yolox/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/cv/.vscode-server/extensions/ms-python.python-2023.4.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
cli.main()
File "/home/cv/.vscode-server/extensions/ms-python.python-2023.4.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/home/cv/.vscode-server/extensions/ms-python.python-2023.4.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
runpy.run_path(target, run_name="__main__")
File "/home/cv/.vscode-server/extensions/ms-python.python-2023.4.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/cv/.vscode-server/extensions/ms-python.python-2023.4.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/cv/.vscode-server/extensions/ms-python.python-2023.4.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/home/cv/yy/5.semi-object/efficientteacher-main/scripts/mula_convertor/convert_pt_to_efficient.py", line 92, in <module>
convert_yolov5_to_efficient( '/home/cv/yj/5.semi-object/efficientteacher-main/weights/train_yolov5/best.pt', '/home/cv/yy/5.semi-object/efficientteacher-main/configs/ssod/custom/yolov5s_spore_ssod.yaml','/home/cv/yj/5.semi-object/efficientteacher-main/efficient-yolov5s.pt')
File "/home/cv/yy/5.semi-object/efficientteacher-main/scripts/mula_convertor/convert_pt_to_efficient.py", line 40, in convert_yolov5_to_efficient
cfg.merge_from_file(cfg_path)
File "/home/cv/yy/5.semi-object/efficientteacher-main/scripts/mula_convertor/configs/yacs.py", line 209, in merge_from_file
self.merge_from_other_cfg(cfg)
File "/home/cv/yy/5.semi-object/efficientteacher-main/scripts/mula_convertor/configs/yacs.py", line 213, in merge_from_other_cfg
_merge_a_into_b(cfg_other, self, self, [])
File "/home/cv/yy/5.semi-object/efficientteacher-main/scripts/mula_convertor/configs/yacs.py", line 460, in _merge_a_into_b
_merge_a_into_b(v, b[k], root, key_list + [k])
File "/home/cv/yy/5.semi-object/efficientteacher-main/scripts/mula_convertor/configs/yacs.py", line 473, in _merge_a_into_b
raise KeyError("Non-existent config key: {}".format(full_key))
KeyError: 'Non-existent config key: SSOD.ignore_thres_low'
指定yolov5l_custom.yaml
配置文件,则成功转换了模型 @BowieHsu
@BowieHsu _and the control parameter of the supervised round is burn_in_epoch. As many times as set here, the number of times of supervised training will be performed first, and then (epoch - burn_in_epoch) times semi-supervised training of_
What would be labels used here for 200 epochs during in supervised phase, is it referring to the 10% labelled images label ? What are the pretrained weights ,are they the native YOlo L weights on coco set which we convert first ?
我现在准备了一份自己的数据集,标准的COCO格式。并且也准备了一份转化的YOLO格式的数据集。对这份数据也完成了切分,切分后的格式也准备成了YOLO格式,格式如下: 如果我想使用该仓库进行半监督的任务,请问我应该如何操作?