Skip to content

squatboy/ONNX-barpath-track

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ONNX-barpathtrack-api

Provides on-screen visualization of the barbell's movement and the accuracy of its vertical trajectory.

Info

  • Model : Trained YOLOv5s to ONNX
  • Datasets : Custom dataset built for barbell recognition instead of COCO (trained with a single class)
  • Performance Evaluation: Evaluated Precision, Recall, mAP, etc., using val.py
  • Epochs: 20
  • Final mAP: 86%

Training 

labels labels_correlogram

API Endpoint Built

FastAPI

Logic

  • Applied confidence-based filtering and Non-Maximum Suppression (NMS) -> selects representative detections
  • Confidence threshold thresh = 0.3

Examples

Screenshot 2025-02-13 at 11 28 54 AM (KST) image

Train Batches

train_batch0


Usage

Requirements

pip install -r requirements.txt

Running the Server

uvicorn main:app --reload

API Endpoints

/process_video/ (POST)

Upload a video file for processing.

Request Body (multipart/form-data):

  • file: Video file (.mp4).

Example curl:

curl -X POST -F "file=@your_video.mp4" [http://127.0.0.1:8000/process_video/](http://127.0.0.1:8000/process_video/)

Response (JSON):

{
  "vertical_accuracy": 95.23,
  "video_url": "/get_video/output_unique_filename.mp4"
}

/get_video/{filename} (GET)

Download the processed video.

Example URL:

http://127.0.0.1:8000/get_video/output_unique_filename.mp4


Prob

  • Dataset labeling is required.   
  • Potential for overfitting due to an insufficient number of training data.

Solution

  • Performed direct labeling using LabelImg.   
  • Potential improvements: Applying Data augmentation (horizontal flip, color variations, etc.) to secure data diversity and enhance the model's generalization performance.

Prob

  • Impact on trajectory and vertical accuracy in object unrecognition intervals. (Connects the last recognized position and the newly recognized position with a straight line)

Solution

  • Handling of object unrecognition intervals and re-detection after prolonged object loss. Setup variables related to interval re-detection:
last_detection_frame = -1  # Frame number when the object was last detected
current_frame = 0  # Current frame number
max_frame_gap = int(fps * 1.5)  # Maximum allowed frame gap (1.5 seconds)

About

Provides on-screen visualization of barbell movement and vertical trajectory accuracy via REST API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published