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

Fix darknet_video.py to so it's not off by 1 frame #6717

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

Commits on Sep 22, 2020

  1. Update darknet_video.py

    The issue:
    Previously the output videofile had detections off by 1 frame from the video. 
    The reason: 
    The `darknet_image` is overwritten in `video_capture` every time it's being created because it sits in the same memory so effectively the `darknet_image_queue` is not working properly
    
    Changes:
    - `darknet_image` is created in every iteration of `video_capture` so every new `darknet_image` sits in different memory
    - remove limitations on `max_size` of the queue. I believe the limitations were put there to avoid the issue above, but it only made it so the result was off by one frame. Now that that's not an issue there is no reason to have `max_size` for any of the queques
    mazatov committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    2d680ed View commit details
    Browse the repository at this point in the history
  2. Put maxsize to 250 to avoid memory overload

    Added maxsize so there is no memory overload in case too many frames load for the detect_image.
    mazatov committed Sep 22, 2020
    Configuration menu
    Copy the full SHA
    4a61d97 View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2020

  1. Update darknet_video.py

    I was getting a memory problem because as `darknet_image` is created in every iteration of `video_capture`, it is not being released by the `darknet_image_queue` when it gets `.get()`. 
    
    To fix it I make a list of darknet_images that is larger than the size of the queue. The list is being repeatedly updated with new darknet_images in `video_capture`, but the image that has not been processed yet, is never overwritten. A bit of a hacky fix, but it works.
    mazatov committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    c788ce1 View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2020

  1. Update darknet_video.py

    Define `darknet_images`
    mazatov committed Sep 29, 2020
    Configuration menu
    Copy the full SHA
    6a8d506 View commit details
    Browse the repository at this point in the history

Commits on Apr 16, 2021

  1. Configuration menu
    Copy the full SHA
    b94f949 View commit details
    Browse the repository at this point in the history