LdDl / go-darknet

Go bindings for Darknet (YOLO v4 / v7-tiny / v3)
Apache License 2.0
82 stars 19 forks source link

Custom yolov7 pytorch #28

Open alemelis opened 2 years ago

alemelis commented 2 years ago

Hello! Is there any way to use custom yolov7-tiny models trained with the official PyTorch repo? I imagine I need to translate from .pt to .weights format, any hint on how to do that?

LdDl commented 2 years ago

Hi! Can you provide more details on it? What is official Pytorch repository for YOLOv7-tiny? I'm aware of AlexeyAB's only and it is C/C++ all about

UPD: .pt -> .weights should easy though anyways

alemelis commented 2 years ago

@LdDl thanks for the reply!

yolov7 official repository is this one https://github.com/WongKinYiu/yolov7 as also AlexeyAB mention in his fork https://github.com/AlexeyAB/darknet/issues/8595

at the moment there are two options for training a custom v7 model:

  1. train in pytorch with https://github.com/WongKinYiu/yolov7 by using imagenet pre-trained weights from there
  2. train in C/C++ with darknet https://github.com/AlexeyAB/darknet by using imagenet pre-trained weights provided by Alexey

The benefit of 1 is that you can use all the new augmentation strategies proposed in the paper https://arxiv.org/abs/2207.02696 . This is not true for 2 as these have not been implemented fully yet. Hence in 2 I'd have a sub-par model.

The problem with 1 is that I get a .pt file and it is not really clear to me how I should go and convert the file. See here