handball-detection is a project which uses computer vision techniques to detect handballs in football matches.
git clone https://github.com/nadimra/handball-detection.git
- Go to the
project_HRNet
directory andpip install -r requirements.txt
. - Download the pretrained weights for the HRNet object detector and place it within
/project_HRNet/models/detectors/yolo/weights
. We used yolov3.weights. - Download the pretrained weights for HRNet and place it within
/project_HRNet/weights
. We used pose_hrnet_w48_384x288.pth.
- Go to the
project_yolo5
directory andpip install -r requirements.txt
. - Download the pretrained weights for yolov5 and place it within
/project_yolo5/weights
. We use yolo5s.pt.
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.
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.
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.
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
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.
Our code is built on HRNet and YOLOv5. We thank the authors for sharing their codes.