Spaces:
Sleeping
Sleeping
Denny Lulak commited on
Commit ·
fa35c9b
1
Parent(s): 8afb113
Fix
Browse files- app.py +1 -0
- inference.py +1 -1
app.py
CHANGED
|
@@ -71,6 +71,7 @@ async def detect_objects(file: UploadFile = File(...)):
|
|
| 71 |
|
| 72 |
image_data = await file.read()
|
| 73 |
image = cv2.imdecode(np.frombuffer(image_data, np.uint8), cv2.IMREAD_COLOR)
|
|
|
|
| 74 |
if image is None:
|
| 75 |
raise HTTPException(400, "Invalid image data")
|
| 76 |
|
|
|
|
| 71 |
|
| 72 |
image_data = await file.read()
|
| 73 |
image = cv2.imdecode(np.frombuffer(image_data, np.uint8), cv2.IMREAD_COLOR)
|
| 74 |
+
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # <<< ADD THIS LINE
|
| 75 |
if image is None:
|
| 76 |
raise HTTPException(400, "Invalid image data")
|
| 77 |
|
inference.py
CHANGED
|
@@ -68,7 +68,7 @@ class ObjectDetector:
|
|
| 68 |
original_shape: Tuple[int, int],
|
| 69 |
scale: float,
|
| 70 |
padding: Tuple[int, int],
|
| 71 |
-
conf_threshold: float = 0.
|
| 72 |
iou_threshold: float = 0.45
|
| 73 |
) -> List[Dict]:
|
| 74 |
predictions = np.squeeze(predictions).T
|
|
|
|
| 68 |
original_shape: Tuple[int, int],
|
| 69 |
scale: float,
|
| 70 |
padding: Tuple[int, int],
|
| 71 |
+
conf_threshold: float = 0.3,
|
| 72 |
iou_threshold: float = 0.45
|
| 73 |
) -> List[Dict]:
|
| 74 |
predictions = np.squeeze(predictions).T
|