A Go-based facial recognition system with REST API endpoints for training and comparing faces.
- Face training with unique identifiers
- Face comparison with similarity scores
- RESTful API endpoints
- Base64 image support
- Local storage of face embeddings
- Docker support
- Docker and Docker Compose
- Go 1.21+ (for local development)
- Clone the repository
- Create a
models
directory and download the required face recognition models - Run with Docker Compose:
docker-compose up --build
The API will be available at http://localhost:8080
POST /train
Content-Type: application/json
{
"image": "base64_encoded_image",
"person_id": "unique_identifier"
}
POST /compare
Content-Type: application/json
{
"image": "base64_encoded_image"
}
Response:
{
"person_id": "matched_identifier",
"similarity": 0.95
}
- Install dependencies:
go mod download
- Run locally:
go run cmd/api/main.go
.
├── cmd/
│ └── api/
│ └── main.go
├── internal/
│ ├── api/
│ │ └── handler.go
│ ├── face/
│ │ └── service.go
│ └── storage/
│ └── service.go
├── models/ # Face recognition models
├── data/ # Stored face embeddings
├── Dockerfile
├── docker-compose.yml
└── README.md
The application uses the following default configuration:
- Server port: 8080
- Face similarity threshold: 0.6
- Storage location: ./data/faces.json
MIT License