This is a full-stack multi-object tracking system built with React (frontend) and Flask (backend), utilizing YOLOv5 for object detection and a combination of multiple tracking metrics including the Hungarian algorithm for optimal association. The processed videos and related information are stored in Amazon S3, while MongoDB is used as the primary database to store metadata about the uploaded files.
- Real-time object detection using YOLOv5
- Multi-metric tracking system combining:
- IoU (Intersection over Union)
- Sanchez-Matilla distance
- Yu exponential cost function
- Deep feature matching using Siamese networks
- Hungarian algorithm for optimal detection-track association
- Track management with age-based filtering
- Full-stack integration with React frontend, Flask backend, MongoDB database, and AWS S3 for file storage
- Unique file ID generation upon upload, which allows retrieval of tracking statistics and processed videos
- Built with Vite + TypeScript for fast and modular development
- Provides a user-friendly UI to:
- Upload files
- Retrieve tracking statistics
- View processed videos stored in Amazon S3
- Handles file uploads and processing
- Stores file metadata in MongoDB
- Generates and returns a unique file ID for each uploaded file
- Provides APIs to fetch tracking results and serve processed videos from S3
- Amazon S3 stores processed video files
- MongoDB stores metadata including file ID, file name, and S3 links
├── dataset/
│ ├── images/
│ ├── nvidia_ai_challenge_images/
│ └── surveillance_videos/
├── models/
│ ├── coco.names
│ ├── model640.pt
│ └── yolov5s.pt
├── object_tracking.py
├── object_tracking_api.py
├── siamese_net.py
├── requirements.txt
├── object-tracking-frontend/
│ ├── src/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── assets/
│ │ ├── App.tsx
│ │ ├── Navbar.tsx
│ │ ├── UploadComponent.tsx
│ │ ├── FetchResults.tsx
│ │ ├── ViewVideo.tsx
│ ├── package.json
│ ├── vite.config.ts
│ ├── tsconfig.json
│ └── README.md
└── README.md
-
Clone the repository:
git clone https://github.com/yourusername/object-tracking.git cd object-tracking -
Setup the backend:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Setup the frontend:
cd object-tracking-frontend npm install npm run dev
- Navigate to the Upload File page.
- Upload a video file.
- A unique file ID will be generated and stored in the database.
- The Home page displays all stored file IDs.
- The user can copy a file ID and use it to fetch tracking statistics.
- The processed video is stored in S3, and the link is retrieved from MongoDB.
- Enter a File ID in the View Processed Video page to watch the processed result.
- Processing Speed: ~20-30 FPS (hardware-dependent)
- Detection Accuracy: >90% mAP@0.5 (YOLOv5s)
- Tracking Robustness: Effectively handles occlusions and object interactions
- Efficient frame processing with OpenCV
- Batch processing for feature extraction
- GPU acceleration supported for both detection and feature extraction
- Vectorized operations for cost matrix computation
- Hungarian algorithm for efficient tracking
- Parallel processing of detection and feature extraction
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Question in interview.
- How will you handle failure? OR What will be the system behavior if backend goes down or ML part of script is down ? Ans: Currently system architecture is tightly coupled. Video uploaded -> sent to backend -> sent to ML part -> results recived -> pushed to MongoDB & S3. Anything of this goes down, complete application is down. So it is tightly coupled. To make it robust, Use AWS SQS and lambda. between All stages of application so if any of part goes down, application is not down and data is not lost.