Spaces:
Build error
Build error
First model version
Browse files
app.py
CHANGED
|
@@ -36,11 +36,12 @@ def infer(filepath):
|
|
| 36 |
)
|
| 37 |
|
| 38 |
image = cv2.imread(filepath)
|
|
|
|
|
|
|
| 39 |
patchs = [image[box[1]:box[3], box[0]:box[2], :] for box in result_boxes]
|
| 40 |
patchs = [preprocess(patch, config.dataset_image_width, config.dataset_image_height) for patch in patchs]
|
| 41 |
patchs = torch.stack(patchs, dim=0)
|
| 42 |
|
| 43 |
-
result_polygons, result_masks, result_boxes = det_demo.run_on_opencv_image(image)
|
| 44 |
visual_image = det_demo.visualization(image.copy(), result_polygons, result_masks, result_boxes)
|
| 45 |
|
| 46 |
cv2.imwrite('result.jpg', visual_image)
|
|
|
|
| 36 |
)
|
| 37 |
|
| 38 |
image = cv2.imread(filepath)
|
| 39 |
+
result_polygons, result_masks, result_boxes = det_demo.run_on_opencv_image(image)
|
| 40 |
+
|
| 41 |
patchs = [image[box[1]:box[3], box[0]:box[2], :] for box in result_boxes]
|
| 42 |
patchs = [preprocess(patch, config.dataset_image_width, config.dataset_image_height) for patch in patchs]
|
| 43 |
patchs = torch.stack(patchs, dim=0)
|
| 44 |
|
|
|
|
| 45 |
visual_image = det_demo.visualization(image.copy(), result_polygons, result_masks, result_boxes)
|
| 46 |
|
| 47 |
cv2.imwrite('result.jpg', visual_image)
|