Skip to content

shallwe999/TransNetV2-SBD-Visualize

Repository files navigation

TransNet V2 Visualization for Shot Boundary Detection


Introduction: A simple Python interface to show shot boundary detection based on TransNet V2.
Repo size: 55 MB
Hint: We just use the pretrained model here. If you want to train it, please see the TransNet V2 repo.
Modifier: Shallwe
Author: Tomáš Souček
Paper: TransNet V2: An effective deep network architecture for fast shot transition detection


Environment

Recommended to run in Linux. Tested in Ubuntu 18.04 .

Necessary environments include TensorFlow, ffmpeg, OpenCV, PIL, Tkinter and so on, run these commands to install them.

pip install tensorflow==2.1
pip install opencv-python ffmpeg-python pillow
sudo apt install ffmpeg python-tk

How to run

# Run it in the project directory
python3 main.py

Files Prepared:

  • Original video. (MP4 format recommended)

  • Label files of SBD. (Same directory as video. Named as "VIDEO_NAME+.truth.txt")

In directory test_data/ , I provide a video bbc_02_clip.mp4 as an example (Clipped from BBC Planet Earth Test Dataset. You can download more test videos here.) to help you test this program.

Process:

  • Input location of video file. (Need to provide relative path from current work directory such as test_data/bbc_02_clip.mp4 )

  • Select "Device Select" (Recommend default)

  • Click "Shot boundary detection"

  • Wait for the evaluation of the model (until SBD success appears in cmd)

  • Click "Visualize"

  • You can click "Start" or "Pause" while video is playing

  • Click "Quit"

Files created:

  • VIDEO_PATH/video.mp4.scenes.txt file containing a list of scenes - pairs of start-frame-index, end-frame-index (indexed from zero, both limits inclusive).
  • VIDEO_PATH/video.mp4.predictions.txt file with each line containing raw predictions for corresponding frame (fist number is from the first 'single-frame-per-transition' head, the second from 'all-frames-per-transition' head)
  • optionally it creates visualization in file /path/to/video.mp4.vis.png

Credits

If found useful, please cite the author.

About

A simple GUI to show shot boundary detection based on TransNet V2.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published