Skip to content

The copy of the model containing the ability to export detection results that have already been post-processed and do not require further actions in the application on the device

License

Notifications You must be signed in to change notification settings

Gainward777/yolov5

 
 

The changes made to this copy of YOLOv5 are intended primarily to get rid of post-processing on the device after export.
Additionally, a simple sorting of results was added to work with ordered recognized objects, such as numerical sequences.


Changelog:


  • models/experimental.py
    line 118 add:
    #sort ordered recognized objects
      def new_sorter
    line 126 add:
    #nms from main model with little changes that solve the problem with the occurrence of errors when exporting using torch.jit.trace
      def nms_lite
  • models/yolo.py
    line 169 add:
    #flag for add postprocessing to export. when True on device u got only detections
      is_export=False
    line 172 add:
    #defoult treshhold for experimental.py/new_sort (sort detected digits on axis X)
      treshhold=0.8
    line 214 (def forward) change:
     if augment to if augment and not self.is_export 
    line 216 change:
    return self._forward_once(x, profile, visualize)
    to (our outputs)
      out=self._forward_once(x, profile, visualize)    
      if self.is_export:      
        return new_sorter(nms_lite(out)[0], self.treshhold)      
      else:
        return out
  • export.py
    line 120 change:
    f = file.with_suffix('.torchscript')
    to
    f = file.with_suffix('.torchscript.ptl')
    line 542 add:
    model.is_export=True

By default, the flag is set to false in order to avoid affecting the training process of the model.
Changes are relevant only for the exported model, therefore the truth is set only when exporting

The results can be seen:
Jupyter Notebook
Android App

About

The copy of the model containing the ability to export detection results that have already been post-processed and do not require further actions in the application on the device

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.5%
  • Other 1.5%