mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Various fixes & tweaks (#17308)
* Catch case where returned face box is invalid * Update detector docs * Add note for customizing rfdetr resolution
This commit is contained in:
		
							parent
							
								
									d32949017b
								
							
						
					
					
						commit
						17e14cefd9
					
				@ -344,6 +344,12 @@ Note that the labelmap uses a subset of the complete COCO label set that has onl
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[D-FINE](https://github.com/Peterande/D-FINE) is a DETR based model. The ONNX exported models are supported, but not included by default. See [the models section](#downloading-d-fine-model) for more information on downloading the D-FINE model for use in Frigate.
 | 
					[D-FINE](https://github.com/Peterande/D-FINE) is a DETR based model. The ONNX exported models are supported, but not included by default. See [the models section](#downloading-d-fine-model) for more information on downloading the D-FINE model for use in Frigate.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					:::warning
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Currently D-FINE models only run on OpenVINO in CPU mode, GPUs currently fail to compile the model
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					:::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
After placing the downloaded onnx model in your config/model_cache folder, you can use the following configuration:
 | 
					After placing the downloaded onnx model in your config/model_cache folder, you can use the following configuration:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
@ -653,7 +659,7 @@ Note that the labelmap uses a subset of the complete COCO label set that has onl
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
After placing the downloaded onnx model in your `config/model_cache` folder, you can use the following configuration:
 | 
					After placing the downloaded onnx model in your `config/model_cache` folder, you can use the following configuration:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```yaml
 | 
				
			||||||
detectors:
 | 
					detectors:
 | 
				
			||||||
  onnx:
 | 
					  onnx:
 | 
				
			||||||
    type: onnx
 | 
					    type: onnx
 | 
				
			||||||
@ -671,7 +677,7 @@ model:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[D-FINE](https://github.com/Peterande/D-FINE) is a DETR based model. The ONNX exported models are supported, but not included by default. See [the models section](#downloading-d-fine-model) for more information on downloading the D-FINE model for use in Frigate.
 | 
					[D-FINE](https://github.com/Peterande/D-FINE) is a DETR based model. The ONNX exported models are supported, but not included by default. See [the models section](#downloading-d-fine-model) for more information on downloading the D-FINE model for use in Frigate.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
After placing the downloaded onnx model in your config/model_cache folder, you can use the following configuration:
 | 
					After placing the downloaded onnx model in your `config/model_cache` folder, you can use the following configuration:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
detectors:
 | 
					detectors:
 | 
				
			||||||
@ -898,11 +904,21 @@ Make sure you change the batch size to 1 before exporting.
 | 
				
			|||||||
To export as ONNX:
 | 
					To export as ONNX:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1. `pip3 install rfdetr`
 | 
					1. `pip3 install rfdetr`
 | 
				
			||||||
2. `python`
 | 
					2. `python3`
 | 
				
			||||||
3. `from rfdetr import RFDETRBase`
 | 
					3. `from rfdetr import RFDETRBase`
 | 
				
			||||||
4. `x = RFDETRBase()`
 | 
					4. `x = RFDETRBase()`
 | 
				
			||||||
5. `x.export()`
 | 
					5. `x.export()`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Additional Configuration
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The input tensor resolution can be customized:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```python
 | 
				
			||||||
 | 
					from rfdetr import RFDETRBase
 | 
				
			||||||
 | 
					x = RFDETRBase(resolution=560)  # resolution must be a multiple of 56
 | 
				
			||||||
 | 
					x.export()
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Downloading YOLO-NAS Model
 | 
					### Downloading YOLO-NAS Model
 | 
				
			||||||
 | 
					
 | 
				
			||||||
You can build and download a compatible model with pre-trained weights using [this notebook](https://github.com/blakeblackshear/frigate/blob/dev/notebooks/YOLO_NAS_Pretrained_Export.ipynb) [](https://colab.research.google.com/github/blakeblackshear/frigate/blob/dev/notebooks/YOLO_NAS_Pretrained_Export.ipynb).
 | 
					You can build and download a compatible model with pre-trained weights using [this notebook](https://github.com/blakeblackshear/frigate/blob/dev/notebooks/YOLO_NAS_Pretrained_Export.ipynb) [](https://colab.research.google.com/github/blakeblackshear/frigate/blob/dev/notebooks/YOLO_NAS_Pretrained_Export.ipynb).
 | 
				
			||||||
 | 
				
			|||||||
@ -329,7 +329,11 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
 | 
				
			|||||||
                max(0, face_box[1]) : min(frame.shape[0], face_box[3]),
 | 
					                max(0, face_box[1]) : min(frame.shape[0], face_box[3]),
 | 
				
			||||||
                max(0, face_box[0]) : min(frame.shape[1], face_box[2]),
 | 
					                max(0, face_box[0]) : min(frame.shape[1], face_box[2]),
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
            face_frame = cv2.cvtColor(face_frame, cv2.COLOR_RGB2BGR)
 | 
					
 | 
				
			||||||
 | 
					            try:
 | 
				
			||||||
 | 
					                face_frame = cv2.cvtColor(face_frame, cv2.COLOR_RGB2BGR)
 | 
				
			||||||
 | 
					            except Exception:
 | 
				
			||||||
 | 
					                return
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            # don't run for object without attributes
 | 
					            # don't run for object without attributes
 | 
				
			||||||
            if not obj_data.get("current_attributes"):
 | 
					            if not obj_data.get("current_attributes"):
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user