Views
No views yet
1from inference_api import WildlifeDetectorAPI
2
3detector = WildlifeDetectorAPI(
4 model_path="model_final.pth",
5 config_path="production_config.json"
6)
7result = detector.predict("image.jpg", confidence_threshold=0.5)
8print(result)1{
2 "success": true,
3 "detections": [
4 {
5 "class_id": 0,
6 "class_name": "antelope",
7 "confidence": 0.85,
8 "confidence_level": "high",
9 "bbox": {
10 "x1": 100.0,
11 "y1": 200.0,
12 "x2": 300.0,
13 "y2": 450.0,
14 "width": 200.0,
15 "height": 250.0
16 }
17 }
18 ],
19 "summary": {
20 "total_detections": 1,
21 "high_confidence": 1,
22 "medium_confidence": 0,
23 "low_confidence": 0
24 }
25}1pip install -r requirements.txt
2# Install detectron2 (platform-specific, example for CUDA 11.3, PyTorch 1.10)
3pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.htmlmodel_final.pth: Trained model weightsproduction_config.json: Production configurationinference_api.py: Inference script for API integrationrequirements.txt: Dependencies