For testing and saving videos using darknet_video.py #5415
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
therefore added the following, it breaks out of the loop when the video file ends.
2.The output frames were not being written to the file by the VideoWriter, the following will write the processed frame to the file
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).