Cyril666 commited on
Commit
d2fc4b7
·
1 Parent(s): 38475a2

First model version

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. det_demo.py +2 -3
app.py CHANGED
@@ -25,7 +25,7 @@ def infer(filepath):
25
  )
26
  image = cv2.imread(filepath)
27
  result_polygons, result_masks, result_boxes = det_demo.run_on_opencv_image(image)
28
- image = det_demo.visualization(image, result_polygons, result_masks, result_boxes)
29
  cv2.imwrite('result.jpg', image)
30
  return 'result.jpg'#, pd.DataFrame(result_words)
31
 
 
25
  )
26
  image = cv2.imread(filepath)
27
  result_polygons, result_masks, result_boxes = det_demo.run_on_opencv_image(image)
28
+ visual_image = det_demo.visualization(image, result_polygons, result_masks, result_boxes)
29
  cv2.imwrite('result.jpg', image)
30
  return 'result.jpg'#, pd.DataFrame(result_words)
31
 
det_demo.py CHANGED
@@ -443,7 +443,7 @@ class DetDemo(object):
443
  prediction = prediction.resize((image_width, image_height))
444
  if len(prediction) == 0:
445
  return
446
- prediction = prediction.convert("xywh")
447
  boxes = prediction.bbox.tolist()
448
  scores = prediction.get_field("scores").tolist()
449
  masks_x = prediction.get_field("mask_x")
@@ -581,8 +581,7 @@ class DetDemo(object):
581
  for mask in masks:
582
  image[mask] = image[mask] * 0.5 + green[mask] * 0.5
583
  for box in boxes:
584
- print(box)
585
- cv2.rectangle(image,box,True,(0,0,255))
586
  '''
587
  for polygon in polygons:
588
  pts = np.array(polygon, np.int32)
 
443
  prediction = prediction.resize((image_width, image_height))
444
  if len(prediction) == 0:
445
  return
446
+ prediction = prediction.convert("xyxy")
447
  boxes = prediction.bbox.tolist()
448
  scores = prediction.get_field("scores").tolist()
449
  masks_x = prediction.get_field("mask_x")
 
581
  for mask in masks:
582
  image[mask] = image[mask] * 0.5 + green[mask] * 0.5
583
  for box in boxes:
584
+ cv2.rectangle(image,(box[0], box[1]), (box[2], box[3]), (0,0,255), 5)
 
585
  '''
586
  for polygon in polygons:
587
  pts = np.array(polygon, np.int32)