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

I have trained my data. But it doesn't work with your code. #4

Open
Filmimagine opened this issue Feb 16, 2023 · 3 comments
Open

I have trained my data. But it doesn't work with your code. #4

Filmimagine opened this issue Feb 16, 2023 · 3 comments
Labels
question Further information is requested

Comments

@Filmimagine
Copy link

❔Question

I have trained my data. But it doesn't work with your code.

Additional context

PS D:\project-crop-row> python detect.py --img 320 --weights cropbest.pt --source "test1.mp4" --conf 0.4
Traceback (most recent call last):
File "D:\project-crop-row\detect.py", line 358, in
detect()
File "D:\project-crop-row\detect.py", line 63, in detect
model = attempt_load(weights, map_location=device) # load FP32 model
File "D:\project-crop-row\models\experimental.py", line 118, in attempt_load
ckpt = torch.load(w, map_location=map_location) # load
File "C:\Users\NITRO\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 712, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "C:\Users\NITRO\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 1049, in _load
result = unpickler.load()
File "C:\Users\NITRO\AppData\Roaming\Python\Python39\site-packages\torch\serialization.py", line 1042, in find_class
return super().find_class(mod_name, name)
AttributeError: Can't get attribute 'DetectionModel' on <module 'models.yolo' from 'D:\project-crop-row\models\yolo.py'>

@Filmimagine Filmimagine added the question Further information is requested label Feb 16, 2023
@WoodratTradeCo
Copy link
Owner

This is because the new and old versions of YOLOv5 are incompatible, and the yolo.py file under models is missing the DetectionModel module code. It is recommended that you make changes in the model by comparing the latest Yolo source code as following URL: https://blog.csdn.net/weixin_46389664/article/details/129306692

@Filmimagine
Copy link
Author

Filmimagine commented Mar 6, 2023

@WoodratTradeCo
Thank you very much, I'll try it, do you have a way to contact you? in case i encounter a problem

@Filmimagine
Copy link
Author

Filmimagine commented Mar 9, 2023

@WoodratTradeCo I can train my data from your code? how do you configure

I tried training from your file and it crashes.

D:\UAV\project-crop-row>python train.py --img 640 --batch 8 --epochs 100 --data config.yaml --weights yolov5.pt --workers 4 --cache --device 0
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\logging\config.py", line 618, in configure
self.configure_logger(name, loggers[name])
File "C:\Program Files\Python39\lib\logging\config.py", line 794, in configure_logger
logger = logging.getLogger(name)
File "C:\Program Files\Python39\lib\logging_init_.py", line 2042, in getLogger
return Logger.manager.getLogger(name)
File "C:\Program Files\Python39\lib\logging_init_.py", line 1297, in getLogger
raise TypeError('A logger name must be a string')
TypeError: A logger name must be a string

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\UAV\project-crop-row\train.py", line 497, in
set_logging(opt.global_rank)
File "D:\UAV\project-crop-row\utils\general.py", line 42, in set_logging
logging.config.dictConfig({
File "C:\Program Files\Python39\lib\logging\config.py", line 809, in dictConfig
dictConfigClass(config).configure()
File "C:\Program Files\Python39\lib\logging\config.py", line 620, in configure
raise ValueError('Unable to configure logger '
ValueError: Unable to configure logger -1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants