WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.36k stars 4.21k forks source link

How to convert model segment to tflife in branch u7? #716

Open MinhThanghus opened 2 years ago

MinhThanghus commented 2 years ago

I train the model successfully, but can't convert it to tflife, souce not support. @WongKinYiu thanks you so much

dnsefe commented 2 years ago

Afaik, MP and SPPCSPC is not implemented for TF. Could you provide some logs for the conversion process?

EDIT: Looks like ISegment, IDetect etc. are also not available for TF. @WongKinYiu will it be implemented in the future?

ibaiGorordo commented 2 years ago

I implemented it in u5 instead of u7, but here is my implementation of the missing functions (MP, SPPCSPC, RepConv): https://github.com/WongKinYiu/yolov7/pull/792

I think IDetect is not necessary because once you reparameterize the trained model it will be converted to Detect.

dnsefe commented 2 years ago

@ibaiGorordo I think RepConv is not used at all in u7 (couldn't find it anywhere in the code). However, if you use pre-trained weights from the main branch, you might need it. Looking at yolov7-seg.yaml (seg) or yolov7.yaml (det), the only necessary functions that are missing are MP and SPPCSPC and if you want to use YOLOR detection / segmentations heads, IDetect and ISegment (which additionally requires Proto, ImplicitA and ImplicitM). For IRSegment we would also need Refine.

I am also not sure if IDetect/ISegment etc. is required after reparameterization. For further analysis, you can also have a look at yolov7-seg.pt

MinhThanghus commented 2 years ago

Hi everyone I find solution in https://github.com/AyushExel/yolov5/tree/instance_seg. I tried and convert successfull @ibaiGorordo @sph1n3x