torchyolo icon indicating copy to clipboard operation
torchyolo copied to clipboard

AttributeError when using Strong Sort tracker in TorchYOLO

Open userkw opened this issue 1 year ago • 2 comments

When attempting to use the Strong Sort tracker with the TorchYOLO framework, users encounter an AttributeError. The error occurs when executing the following command:

torchyolo tracker --config_path torchyolo/configs/default_config.yaml --model_type yolov5 --model_path yolov5s.pt --tracker_config_path torchyolo/configs/tracker/strong_sort.yaml --source yl.mp4 Error Message: YOLOv5 2024-3-25 Python-3.8.19 torch-1.13.0+cpu CPU

Fusing layers... Model summary: 214 layers, 7022326 parameters, 0 gradients, 15.9 GFLOPs Adding AutoShape... Traceback (most recent call last): File "C:\Users\elkis\anaconda3\envs\env2\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\elkis\anaconda3\envs\env2\lib\runpy.py", line 87, in run_code exec(code, run_globals) File "C:\Users\elkis\anaconda3\envs\env2\Scripts\torchyolo.exe_main.py", line 7, in File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\torchyolo\cli.py", line 10, in app Fire(torchyolo_app) File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\fire\core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\fire\core.py", line 475, in _Fire component, remaining_args = _CallAndUpdateTrace( File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\torchyolo\predict.py", line 88, in tracker_predict result = model.tracker_predict( File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\torchyolo\predict.py", line 56, in tracker_predict tracker_prediction = self.model.tracker_predict( File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\torchyolo\modelhub\yolov5.py", line 78, in tracker_predict tracker_module = load_tracker_module( File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\torchyolo\tracker\tracker_module.py", line 18, in load_tracker_module tracker_module = load_tracker( File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\torchyolo\tracker\tracker_zoo.py", line 148, in load_tracker tracker_module = create_tracker( File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\torchyolo\tracker\tracker_zoo.py", line 79, in create_tracker distance_function=config.NORFAIR_TRACK.DISTANCE_FUNCTION, AttributeError: 'YamlParser' object has no attribute 'NORFAIR_TRACK'

userkw avatar Mar 25 '24 15:03 userkw

Can you share your code?

kadirnar avatar Mar 25 '24 22:03 kadirnar

@kadirnar I'm just using this command line: : torchyolo tracker --config_path torchyolo/configs/default_config.yaml
--model_type yolov5 --model_path yolov5s.pt
--tracker_config_path norfair.yaml I'm using my custom YOLOv5 model specified here: --model_path yolov5s.pt, which is originally best.pt, but I renamed it to yolov5s. The problem arises when I use --tracker_config_path norfair.yaml with a strong_sort or any other tracker. I encounter this error: tracker_module = create_tracker( File "C:\Users\elkis\anaconda3\envs\env2\lib\site-packages\torchyolo\tracker\tracker_zoo.py", line 79, in create_tracker distance_function=config.NORFAIR_TRACK.DISTANCE_FUNCTION, AttributeError: 'YamlParser' object has no attribute 'NORFAIR_TRACK'

userkw avatar Mar 26 '24 10:03 userkw