Cinfer is a general-purpose Vision AI inference software by CamThink, open to the developer community. It supports deploying Vision AI inference services, provides model management, and exposes standard OpenAPI services. It is suitable for integrating as an image recognition AI component in vision application development, allowing you to call various models for image recognition. It is lightweight and simple, making it ideal for quickly adding models for deployment and project integration.
The system consists of the following main components:
- Backend Service: API service based on FastAPI, providing model management, inference, and monitoring functionality
- Frontend Interface: Web interface based on React, offering user interactions
- Data Storage: Supports SQLite (default) or PostgreSQL databases
The repository ships with a models directory that contains sample ONNX packages ready for import. Each model folder includes the exported weights and a params.yaml or params.yml file describing how the backend should serve it, so you can copy the folder into your persistent model storage (/app/data/models by default) or register it through the API/UI without additional setup. For more details, see the Model Samples guide.
models/object-detection: COCO-style 80-class detector using80-target-detection-yolo-11n.onnxwithparams.yml.models/generic-target-detection: Lightweight digit detector (0–9) packaged asmeter_v5i-6.onnxwithparams.yaml.models/pose-estimation: Human pose estimation sample (yolov8n-pose.onnx) with keypoint outputs defined inparams.yaml.models/instance-seg: Pointer-gauge instance segmentation model (yolov8s-seg-20240816.onnx) relying on thepointerpost-processing strategy and metadata such asscale_min/scale_max.
Cinfer provides the following deployment methods:
- Separated Deployment: Frontend and backend are deployed in separate containers
- Intelligent GPU Support: You can choose whether to enable GPU acceleration. When enabled, the script will automatically detect the
x86_64(Standard PC) orjetson(Jetson/ARM) platforms and select the corresponding Dockerfile for building.
- Docker Engine (20.10.0+)
- Docker Compose (v2.0.0+)
- If using GPU, NVIDIA Docker support is required
The project provides a flexible deployment script deploy.sh, supporting multiple deployment methods and configuration options.
# Deploy with default configuration (separated deployment, frontend port 3000, backend port 8000)
./deploy.sh
# Deploy with GPU support
./deploy.sh --gpu yes
# Customize ports
./deploy.sh --backend-port 8001 --frontend-port 3001
# Specify backend host
./deploy.sh --host 192.168.100.2If you have modified the Dockerfile or source code, you can force rebuilding the image using the following commands:
# Rebuild and start
./deploy.sh --rebuild yes
# Only rebuild the image, do not start
./deploy.sh --action build
# Rebuild a specific instance
./deploy.sh --name prod --rebuild yes# Deploy production environment
./deploy.sh --name prod --gpu yes
# Deploy development environment simultaneously
./deploy.sh --name dev --backend-port 8001 --frontend-port 3001# Stop an instance
./deploy.sh --name prod --action down
# Restart an instance
./deploy.sh --name dev --action restart
# View logs
./deploy.sh --name prod --action logs| Option | Long Option | Description | Default |
|---|---|---|---|
| --arch | Specify GPU architecture: x86_64 or jetson. |
Auto | |
-g |
--gpu |
Use GPU: yes or no | no |
-b |
--backend-port |
Backend service port | 8000 |
-f |
--frontend-port |
Frontend service port | 3000 |
-n |
--name |
Instance name | default |
-a |
--action |
Action: up (start), down (stop), restart (restart), logs (view logs), build (build) | up |
-h |
--host |
Backend hostname or IP address | backend |
-r |
--rebuild |
Rebuild image: yes or no | no |
If you need to manually configure deployment, you can follow the steps below:
Backend environment variables are configured in the backend/docker/prod.env file, mainly including:
- Server configuration (host, port, number of worker processes)
- Database configuration (type, connection info)
- Logging configuration
- Security configuration (JWT keys, etc.)
- Model storage configuration
The frontend configures API proxying through Nginx, with the configuration file at web/nginx.conf.
Data is stored in the following locations:
- Backend Data: Mounted to the container’s
/app/datadirectory - Database: SQLite is used by default, stored at
/app/data/cinfer.db - Model Files: Stored in the
/app/data/modelsdirectory
After deployment, you can access the services at the following addresses:
-
Separated Deployment:
- Frontend:
http://<host-ip>:<frontend-port>(default: 3000) - Backend API:
http://<host-ip>:<backend-port>/api(default: 8000) - Swagger Docs:
http://<host-ip>:<backend-port>/docs
- Frontend:
-
Integrated Deployment:
- App:
http://<host-ip>:<integrated-port>(default: 8080) - API:
http://<host-ip>:<integrated-port>/api - Swagger Docs:
http://<host-ip>:<integrated-port>/docs
- App:
Check the Docker logs for detailed error information:
docker logs <container-id-or-name>Ensure that the proxy_pass in the Nginx configuration points to the correct backend address and port.
Make sure NVIDIA Docker support is correctly installed and your GPU driver versions are compatible.
If you have modified the Dockerfile or source code, use the --rebuild yes parameter to rebuild the image:
./deploy.sh --rebuild yes- Backend: Python, FastAPI, SQLAlchemy, ONNX Runtime
- Frontend: React, TypeScript
- Containerization: Docker, Docker Compose
- Web Server: Nginx
MIT License