mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	fix scaling
This commit is contained in:
		
							parent
							
								
									8fd12f001b
								
							
						
					
					
						commit
						1823bd0305
					
				@ -398,16 +398,17 @@ def detect(
 | 
				
			|||||||
    object_detector, frame, model_shape, region, objects_to_track, object_filters
 | 
					    object_detector, frame, model_shape, region, objects_to_track, object_filters
 | 
				
			||||||
):
 | 
					):
 | 
				
			||||||
    tensor_input = create_tensor_input(frame, model_shape, region)
 | 
					    tensor_input = create_tensor_input(frame, model_shape, region)
 | 
				
			||||||
 | 
					    scale = float(region[2] - region[0]) / model_shape[0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    detections = []
 | 
					    detections = []
 | 
				
			||||||
    region_detections = object_detector.detect(tensor_input)
 | 
					    region_detections = object_detector.detect(tensor_input)
 | 
				
			||||||
    for d in region_detections:
 | 
					    for d in region_detections:
 | 
				
			||||||
        box = d[2]
 | 
					        box = d[2]
 | 
				
			||||||
        size = region[2] - region[0]
 | 
					        size = region[2] - region[0]
 | 
				
			||||||
        x_min = int((box[1]) + region[0])
 | 
					        x_min = int(max(0, box[1]) * scale + region[0])
 | 
				
			||||||
        y_min = int((box[0]) + region[1])
 | 
					        y_min = int(max(0, box[0]) * scale + region[1])
 | 
				
			||||||
        x_max = int((box[3]) + region[0])
 | 
					        x_max = int(min(frame.shape[1], box[3]) * scale + region[0])
 | 
				
			||||||
        y_max = int((box[2]) + region[1])
 | 
					        y_max = int(min(frame.shape[0], box[2]) * scale + region[1])
 | 
				
			||||||
        det = (
 | 
					        det = (
 | 
				
			||||||
            d[0],
 | 
					            d[0],
 | 
				
			||||||
            d[1],
 | 
					            d[1],
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user