SforAiDl / Playground

A python library consisting of pipelines for visual analysis of different sports using Computer Vision and Deep Learning.
MIT License
17 stars 17 forks source link

Refactor Code and Cleaner Output #87

Closed khizirsiddiqui closed 4 years ago

khizirsiddiqui commented 4 years ago
  1. Removes warning when saving video in detect_players_video()
    
    OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'

I have changed video output codec from MP4V to XVID. [Documentation](https://docs.opencv.org/4.2.0/dd/d43/tutorial_py_video_display.html) recommends using XVID in Fedora. It also removes warning in Ubuntu.

2. Moves model initialization from `detect_image()` to `__init__()`.
3. Adds `device` as parameter for `class Detector` to move `model` and tensors in `detect_image()` accordingly.
4. Adds `__init__.py`, `from Badminton import Detector` works now.
5. Raise `FileNotFoundError` for invalid img and video source files.
6. Changed `size_average=True` to `reduction='mean'` in MSE and BCE losses. `size_average` is [depreciated now](https://github.com/pytorch/pytorch/pull/8018)
7. Removes `eta` from `detect_players_video()` as `tqdm` takes care of it.
8. Display changes:
Now:
![image](https://user-images.githubusercontent.com/14289068/84064689-af7a0780-a9e0-11ea-81ea-f95e84c8961d.png)
Before:
![image](https://user-images.githubusercontent.com/14289068/84064496-50b48e00-a9e0-11ea-9f75-165b11948268.png)