RizwanMunawar / yolov7-object-tracking

YOLOv7 Object Tracking Using PyTorch, OpenCV and Sort Tracking
GNU General Public License v3.0
576 stars 174 forks source link

Issue of yolov7.pt file always download #9

Closed parthramanuj64 closed 2 years ago

parthramanuj64 commented 2 years ago

My change is remove [0] because if you are given "opt.weights[0]" so code will check only first value of string so that reason code will always download yoloV7.pt file but if you are remove [0] so code will not always download yoloV7.pt file when yoloV7.pt file will exist

gopalkatariya44 commented 2 years ago

yes, I face this issue.

RizwanMunawar commented 2 years ago

@parthramanuj64! I have tested the code, The original code will not download the file if it already exists. Kindly provide a detailed description of it! like, what is the workflow to reproduce the issue you want to resolve?

RizwanMunawar commented 2 years ago

@learninguser! Kindly provide a detailed workflow. like how you tested that, the code is downloading files every time. I have tested multiple times, and if the file will exist, the code will not download the file again.

learninguser commented 2 years ago

@RizwanMunawar Let's say, my weights are present in D:\yolov7-object-tracking\yolov7.pt on my windows system. When I call python detect_and_track.py --weights D:\yolov7-object-tracking\yolov7.pt --source "your video.mp4" --classes 0 from the terminal, as per your current version of the code on line 294, opt.weights[0] fetches the character 'D' and opt.download is set to true by default. Due to this, the weights are downloaded each time the code is executed.

RizwanMunawar commented 2 years ago

@learninguser! Thanks for providing the detail information. Well! I have tested the steps you explained, but unfortunately, model downloading only for a first time, if file not exists. I have tested on Windows. If I will remove the opt.weights[0], it will return the error logs, shown below.

TypeError: stat: path should be string, bytes, os.PathLike or integer, not list

But, I have resolved this issue.

RizwanMunawar commented 2 years ago

@parthramanuj64 I have merged your pull request with the master branch. It will help lot of people to test object tracking easily. Thanks for your valuable contribution.