/handball_detection

handball-detection is a project which uses computer vision techniques to detect handballs in football matches.

Primary LanguagePython

banner

Handball Detection

handball-detection is a project which uses computer vision techniques to detect handballs in football matches.

Setup

Initial Setup
  1. git clone https://github.com/nadimra/handball-detection.git
HRNet Setup
  1. Go to the project_HRNet directory and pip install -r requirements.txt.
  2. Download the pretrained weights for the HRNet object detector and place it within /project_HRNet/models/detectors/yolo/weights. We used yolov3.weights.
  3. Download the pretrained weights for HRNet and place it within /project_HRNet/weights. We used pose_hrnet_w48_384x288.pth.
yolo5 Setup
  1. Go to the project_yolo5 directory and pip install -r requirements.txt.
  2. Download the pretrained weights for yolov5 and place it within /project_yolo5/weights. We use yolo5s.pt.

How to use

Run the following command: (make sure to change the vid_path variable to pass a video).

python main.py

Outputs are saved in /project_HRNet/outputs. If a handball occured, an additional image decision.png will show the frame of when the handball occured.

Snapshots

handbal-detection-res-1 Textual Output: The ball did hit the player’s hand. The decision is to award a handball since the ball hit the player’s left arm. The arm was at an angle of 78 degrees.

handbal-detection-res-2 Textual Output:The ball did hit the player’s hand.The decision is to award a handball since the ball hit the player’s right arm.The arm was at an angle of 50 degrees.

handbal-detection-res-3 Textual Output: The ball did hit the player’s hand. However, the decision is to not award a handball since the ball hit the player’s right arm at an angle of 38 degrees

handbal-detection-res-4 Textual Output: The ball did hit the player’s hand. However, the decision is to not award a handball since the ball hit the player’s left arm at an angle of 14 degrees.

Acknowledgements

Our code is built on HRNet and YOLOv5. We thank the authors for sharing their codes.