AtomScott / SportsLabKit

A python package for turning sports video into csv files
https://sportslabkit.rtfd.io
GNU General Public License v3.0
237 stars 18 forks source link

Errors notebooks/02_user_guide/detection_with_yolov5.ipynb #100

Closed pushkin-dev closed 1 year ago

pushkin-dev commented 1 year ago

Search before asking

SoccerTrack Component

Training

Bug

When I want to split the video into individual frames. (Step 5 in notebooks/02_user_guide/detection_with_yolov5.ipynb

using soccertrack.datasets.get_path('top_view')


import cv2

for frame_num, frame in enumerate(tqdm(cam.iter_frames())):
    file_path = f'{save_dir}/{frame_num:06d}.png'
    cv2.imwrite(file_path, frame)

Problems:

  1. {frame_num:06d}.png starting from 000000.png (but annotations starts from 000001.txt)
  2. When finishing this step: result 99% - 891/900

Environment

No response

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

AtomScott commented 1 year ago

Hi, thank you for raising this issue! Does this problem persist after reinstalling soccertrack as stated in #101 ?

Camera can also be treated as an iterator itself so the following code should also work:

import cv2

for frame_num, frame in enumerate(tqdm(cam)):
    file_path = f'{save_dir}/{frame_num:06d}.png'
    cv2.imwrite(file_path, frame)
pushkin-dev commented 1 year ago

thanks for quick respond...

Does this problem persist after reinstalling soccertrack as stated in https://github.com/AtomScott/SoccerTrack/issues/101 ?

  1. {frame_num:06d}.png starting from 000000.png (but annotations starts from 000001.txt) - nothing has changed, file numbering starts from 000000.png, i modified the code from file_path = f'{save_dir}/{frame_num:06d}.png' to file_path = f'{save_dir}/{frame_num+1:06d}.png' and everything worked correctly
  2. When finishing this step: result 99% - 891/900 - after reinstalling soccertrack, this proplem is gone.
AtomScott commented 1 year ago

{frame_num:06d}.png starting from 000000.png (but annotations starts from 000001.txt) - nothing has changed, file numbering starts from 000000.png, i modified the code from file_path = f'{save_dir}/{frame_num:06d}.png' to file_path = f'{save_dir}/{frame_num+1:06d}.png' and everything worked correctly

Okay, I need to fix this. I am preparing to release a new version of the dataset so we'll make sure the issue the persist.

AtomScott commented 1 year ago

Closing this issue for now as it will be addressed in the upcoming dataset release.