deep_sort_pytorch icon indicating copy to clipboard operation
deep_sort_pytorch copied to clipboard

how can I use my own yolov3 weights?

Open Y-Mona opened this issue 3 years ago • 20 comments

I can use tracking by my .t7 . In the same time,I also want to use my own weights which is trained with yolov3-spp.cfg and pytorch.I have tried to using the convert() in the model.py to convert .pt to .weight,which was sucessful, but I can't detect anything when I change the detector.py ,the yolov3.yaml and the yolov3_deepsort.py. what should I do?

Y-Mona avatar Apr 30 '21 01:04 Y-Mona

the modification in the code is just to change the path of cfg,weights and the names

Y-Mona avatar Apr 30 '21 01:04 Y-Mona

@Y-Mona how did u convert in the model ?? can u help me please

abdulkafiyahya avatar May 01 '21 02:05 abdulkafiyahya

@ Y-Mona您是 如何在模型中转换的?你能帮我吗

`from models import * model=Darknet("cfg/yolov3-spp.cfg") #your dir of cfg

checkpoint = torch.load("weights/last.pt",map_location='cpu') model.load_state_dict(checkpoint['model']) save_weights(model,path='weights/last.weights',cutoff=-1) ` you can use this code, which comes from the model.py in project yolov3

Y-Mona avatar May 01 '21 02:05 Y-Mona

@ Y-Mona您是 如何在模型中转换的?你能帮我吗

just make a new .py,and put it in yolo

Y-Mona avatar May 01 '21 02:05 Y-Mona

@Y-Mona thank u for ur replay. i did what u say. i maked new.py and i puted it in detector->YOLOv3 folder, but i get "No module named 'models' " ? did i do somthings wrong??

abdulkafiyahya avatar May 02 '21 00:05 abdulkafiyahya

Sorry,I forget it.I used this code in YOLOv3 detection project .the repo:https://github.com/ultralytics/yolov3/tree/archive you can put the code with models.py,and execute it,or try to download the models.py in this project . Because the function I used in the conversion just comes from models.py

Y-Mona avatar May 02 '21 02:05 Y-Mona

hi @Y-Mona ,i did it but i get this error No module named 'models.yolo'; 'models' is not a package any help please

abdulkafiyahya avatar May 08 '21 00:05 abdulkafiyahya

Forgive me for being hasty . you can try to clone the repo of yolov3,then do it in the project .

Y-Mona avatar May 08 '21 02:05 Y-Mona

@Y-Mona the last qustion please. how do making your own .t7 . i am working on Traking Model with may own dataset, do u have project for this ???

abdulkafiyahya avatar May 08 '21 21:05 abdulkafiyahya

我试过yolo3-spp.cfg也是遇到一样的问题,但用yolov3.cfg训练就可以检测到目标了

oomq avatar May 18 '21 08:05 oomq

我试过yolo3-spp.cfg也是遇到一样的问题,但用yolov3.cfg训练就可以检测到目标了

ok我试一下,非非常感谢!

Y-Mona avatar May 18 '21 10:05 Y-Mona

@Y-Mona the last qustion please. how do making your own .t7 . i am working on Traking Model with may own dataset, do u have project for this ??? Sorry, I have been working on my graduation thesis.

  1. download original_ckpt.t7
  2. if you want to track people, use Mars or Market 1501 datasets.else you need Re_ID datastes,such as VeRI which is a car datasets.
  3. then write the code to make your file structure of Re_ID struture the same as Market1501
  4. then python train.py

I will upload my project soon.

Y-Mona avatar May 18 '21 10:05 Y-Mona

@ Y-Mona请问最后一个问题。如何制作自己的.t7。我正在使用可能具有自己的数据集的Traking模型进行工作,您是否有针对此的项目???

my repo https://github.com/Y-Mona/DeepSORT_Pytorch_VeRi

Y-Mona avatar May 21 '21 02:05 Y-Mona

After the test,I got the correct tracking result!I only need to use yolov3.cfg to train the weight of yolo.convert .pt to .weight, then replace the file in detector and modify little settings of parameters

Y-Mona avatar May 21 '21 02:05 Y-Mona

经过测试,我得到了正确的跟踪结果!我只需要使用yolov3.cfg将yolo.convert .pt的权重训练为.weight,然后替换检测器中的文件并修改一些参数设置

What parameters have you changed? I want to use this tracking model and my own yolov3.weights for target detection

mozeqiu avatar Jun 04 '21 08:06 mozeqiu

经过测试,我得到了正确的跟踪结果!我只需要使用yolov3.cfg将yolo.convert .pt的权重训练为.weight,然后替换检测器中的文件并修改一些参数设置

What parameters have you changed? I want to use this tracking model and my own yolov3.weights for target detection

mozeqiu avatar Jun 04 '21 08:06 mozeqiu

麻烦问一下您的YOLO v3权重是自己修改后又训练的么?我想用pth文件进行检测,您可以给出一些建议么?

yuanqiyin avatar Jul 03 '21 07:07 yuanqiyin

麻烦问一下您的YOLO v3权重是自己修改后又训练的么?我想用pth文件进行检测,您可以给出一些建议么?

你换一个模型,用yolov3.cfg 生成的权重转成.pt就行了

Y-Mona avatar Jul 20 '21 00:07 Y-Mona

麻烦问一下您的YOLO v3权重是自己修改后又训练的么?我想用pth文件进行检测,您可以给出一些建议么?

你换一个模型,用yolov3.cfg 生成的权重转成.pt就行了

那大概步骤是不是这样 1.用自己的pytorch版本的yolov3训练,然后得到yolov3.pt文件; 2.利用自己训练的cfg文件进行转化,得到yolov3.weights文件; 3.替换deepsort中所有用到检测权重的地方,例如yolov3.yaml和deepsort.yaml文件; 4.替换检测模型为自己训练时的检测模型,进行跟踪。 请您指导一下,上述可能有不对的地方,我做了前三项工作,第四项正在做,烦请您看到回复一下,谢谢您。

yuanqiyin avatar Jul 22 '21 03:07 yuanqiyin

麻烦问一下您的YOLO v3权重是自己修改后又训练的么?我想用pth文件进行检测,您可以给出一些建议么?

你换一个模型,用yolov3.cfg 生成的权重转成.pt就行了

那大概步骤是不是这样 1.用自己的pytorch版本的yolov3训练,然后得到yolov3.pt文件; 2.利用自己训练的cfg文件进行转化,得到yolov3.weights文件; 3.替换deepsort中所有用到检测权重的地方,例如yolov3.yaml和deepsort.yaml文件; 4.替换检测模型为自己训练时的检测模型,进行跟踪。 请您指导一下,上述可能有不对的地方,我做了前三项工作,第四项正在做,烦请您看到回复一下,谢谢您。

还需要根据你的网络配置更改跟踪文件中的mask,以确定跟踪目标类型。 检测部分中的cfg也要改成你检测模型使用的那个,应该还有names文件之类的。就是目标检测自定义目标修改的文件

Y-Mona avatar Jul 31 '21 01:07 Y-Mona