Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For testing and saving videos using darknet_video.py #5415

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Sambhav300899
Copy link

@Sambhav300899 Sambhav300899 commented Apr 29, 2020

1.If a video was loaded from the file, the loop doesn't break and frame_read is then None. The following line gives an error due to frame_read being of None type

frame_rgb = cv2.cvtColor(frame_read, cv2.COLOR_BGR2RGB)  

therefore added the following, it breaks out of the loop when the video file ends.

if ret == False:
  break

2.The output frames were not being written to the file by the VideoWriter, the following will write the processed frame to the file

out.write(video) 

3.The output writer in the current code writes the frames which are equivalent(in size) to the input of YOLO. To preserve the aspect ratio I made some changes to the arguments of the video writer by passing w,h and fps according to the input video and resized the image after model inference and post processing(drawing bounding boxes and RGB2BGR).

  1. Another change i thought of but didnt know if it was required or not was just adding the video path as an input path or prompting for the video path and output file path etc. Or writing a single script for passing a single image, video or file containing them would also make it easier for users

Sambhav300899 and others added 5 commits April 29, 2020 20:41
1.If a video was loaded from the file, the loop doesn't break and frame_read is then None. The following line gives an error due to frame_read being of None type
```bash
frame_rgb = cv2.cvtColor(frame_read, cv2.COLOR_BGR2RGB)  
```
therefore added the following, it breaks out of the loop when the video file ends.
```bash
if ret == False:
  break
```
2.The output frames were not being written to the file by the VideoWriter, the following will write the processed frame to the file
```bash
out.write(video) 
```
3.The output writer in the current code writes the frames which are equivalent to the input of YOLO. To preserve the aspect ratio I made some changes to the arguments of the video writer by passing w,h and fps according to the input video and resized the image after processing.

4. Another change i thought but didnt know if it was required or not was just adding the video path as an input path or prompting for the video path and output file path etc. Or writing a single script for passing a single image, video or file containing them would also make it easier for users
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants