2

I have trained a yolov3 model in PyTorch with my dataset and I also have written some utility codes for it that run alongside the model all in python language. Now I want to deploy this model and my utilities into a windows desktop app that takes a video and runs the model on its frames. How can I do this task with minimum change in my code or rewrite it in another language? What framework is the best option for designing the UI of the app? Thanks.

Behnamkvl
  • 41
  • 1
  • 4

1 Answers1

2
  1. I would first use your model with PyTorch to detect each frame and use numpy ImageDraw to draw around your object(to be detected). Here is an article on this: Drawing a rectangle inside a 2D numpy array

  2. Then I would use OpenCV(cv2) to append all the frames together to make a video you could also use ffmpeg. Here is a article on this(OpenCV): How to make a movie out of images in python

  3. Then for your UI framework you could use PyQt5 to display your video: Load an opencv video frame by frame using PyQT. But you could also use Kivy with Gstreamer: Kivy VideoPlayer fullscreen, loop, and hide controls

  4. Finally to turn your .py file into a .exe(executable for windows) I would use PyInstaller for that: http://www.pyinstaller.org/

  • thank you for your answer. I have already done steps 1 and 2, as this going to be commercial software in the end, does PyQt5 have good compatibility with windows? Also, as far as I know, Pyinstaller packages all the libraries in one .exe file, however I want to have a traditional setup.exe file and be able to lock or license the app in future. Will I be able to to that with Pyinstaller? – Behnamkvl Jul 14 '20 at 12:29
  • @Behnamkvl 1. For licencing software there is 'Cryptolens': https://www.youtube.com/watch?v=g3twJVAz-iI however it is not a free service. But say you wanted to make your licencing application yourself for free check out https://www.youtube.com/watch?v=IArt2Fgv644 but I wouldnt recommend it as it's lengthy and you would need things like a server with a static ip and it would probably cost the same ammount as Cryptolens account. – Muhammad Bahar Jul 14 '20 at 13:06
  • @Behnamkvl 2. For turning your .exe into a setup.exe for users to install and uninstall easily, I would recommend to use something like 'NSIS':https://www.youtube.com/watch?v=UZX5kH72Yx4 @ 5:30 or you could use Inno: https://www.youtube.com/watch?v=KRMs9z6KoEU I believe there both free but just double check. – Muhammad Bahar Jul 14 '20 at 13:15
  • @Behnamkvl 3. For PyQt5 compatibility it works amazingly with windows but it it based on the Qt framework. I also believe that PyQt5 works on Linux and macOS. https://stackoverflow.com/questions/16846501/how-to-install-pyqt5-on-windows – Muhammad Bahar Jul 14 '20 at 13:21