Skip to content

Given a video of an MMA fight, extract information from all pop-up windows that appear anywhere in the video. Tech: Python (easyocr, cv2, argparse, os, re, json)

Notifications You must be signed in to change notification settings

SaniyaAbushakimova/Extract-Pop-Up-Window-Information-from-MMA-Fights

Repository files navigation

Project completed on January 29, 2023.

Project description

  • Given a video of an MMA fight, extract information from all pop-up windows that appear anywhere in the video. Save result to file_res.json file;
  • Image to text recognition was done with easyocr;
  • Videos were processed one frame per second (usually fps = 25).

Video materials

Playlist 1Playlist 2Playlist 3Playlist 4Playlist 5Playlist 6

Pop-up window types

The above-mentioned videos contain the following types of pop-up windows:

1. state_info:

  • At the beginning of the video, a pop-up window with a brief information about each fighter appears.
  • The window contains full name, record (highlighted in red) and country.

state_info

2. boxer_info:

  • Next in the video, we see a pop-up window with information about each of the fighters.
  • The window contains color, full name, country, record, age, height and weight.

boxer_info

3. time_info:

  • When the figth starts, a pop-up window with the current round time and round number appear. The number of white circles above time indicate current round number. In MMA each round lasts for 5 minutes at most. There are two types of such pop-up windows:

    • Time only - information about the current round time and round number (appears at the beginning and towards the end of the battle).

    time_only_info

    • Time and Boxers-info - information about the current round time, round number, fighters' full names and their respective colors (appears the rest of the time).

    time_boxers_info

4. winner_info:

  • At the end of the video, a pop-up window with the full name of the winner appears.

winner_info

Note

There are videos in which some of the above types of pop-up windows are missing. For example:

The structure of file_res.json

  • boxer_info (if present) :
    video_time_state --- state_info pop-up window timecode (if present)
    video_time_info --- boxer_info pop-up window timecode
    color --- fighter's color
    record --- fighter's record
    age --- fighter's age
    height --- fighter's height
    weight --- fighter's weight
    name --- fighter's full name
    country --- fighter's country
    state --- fighter's state (if present)

  • time_info :
    video_time_state --- time_info pop-up window timecode
    boxer1 --- the first fighter's full name (if present)
    color1 --- the first fighter's color (if present)
    round_num --- round number
    time --- round current time
    color2 --- the second fighter's color (if present)
    boxer2 --- the second fighter's full name (if present)

  • rounds_info :
    round_num --- round number
    video_time_start --- round beginning timecode
    video_time_end --- round ending timecode
    round_duration --- round duration

  • winner_info (if present) :
    video_time --- winner_info pop-up window timecode
    name --- winner's full name
    round_num --- winning round number
    round_num --- winning round time

Launch the script

1. pip install -r requirements.txt
2. python main.py --path_video ./test.mp4 –path_result file_res.json

About

Given a video of an MMA fight, extract information from all pop-up windows that appear anywhere in the video. Tech: Python (easyocr, cv2, argparse, os, re, json)

Topics

Resources

Stars

Watchers

Forks

Languages