This project is a React-based web application that performs real-time object detection using TensorFlow.js and the COCO-SSD (Common Objects in Context - Single Shot Detector) model. It also includes a custom training feature that allows users to add and detect their own object classes.
- Real-time object detection using device camera
- Pre-trained detection for 80+ object classes using COCO-SSD
- Custom object class training and detection
- Live mode and Detect-and-Save mode
- FPS (Frames Per Second) counter in live mode
- Object count statistics
- Detailed view of detected objects
Before you begin, ensure you have met the following requirements:
- Node.js (v12.0 or later)
- npm (usually comes with Node.js)
-
Clone the repository:
git clone https://github.com/your-username/ai-detection-app.git cd ai-detection-app
-
Install the dependencies:
npm install
-
Start the development server:
npm start
-
Open your web browser and navigate to
http://localhost:3000
-
Grant camera permissions when prompted
-
The app will start in live detection mode. You can switch between live mode and detect-and-save mode using the button provided.
-
To add a custom class:
- Enter a name for your new class in the input field
- Click "Add Class"
- Upload one or more images for this class using the file input that appears
-
The app will now attempt to detect your custom objects alongside the pre-trained COCO-SSD objects.
- The app uses TensorFlow.js to load and run the COCO-SSD model in the browser.
- For custom object detection, it uses a simple image similarity comparison.
- In live mode, the app continuously captures frames from the camera and runs object detection on each frame.
- In detect-and-save mode, you can capture a single frame for analysis.
- Custom object detection is based on whole-image similarity, not localized object detection.
- Training data (uploaded images) is stored in memory and will be lost when the page is refreshed.
- Performance may vary depending on the device's capabilities.
- Implement proper storage for training data (e.g., IndexedDB or server-side storage)
- Add more advanced custom training capabilities
- Improve custom object detection accuracy
- Add ability to export and import trained custom models
Contributions to this project are welcome. Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.
- TensorFlow.js team for providing the tools and models
- React team for the excellent web application framework
If you have any questions or feedback, please open an issue in the GitHub repository.
Happy detecting!