Cyril666 commited on
Commit
b5abca7
·
1 Parent(s): e1a24d1

First model version

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. det_demo.py +1 -1
app.py CHANGED
@@ -48,7 +48,7 @@ def infer(filepath):
48
  visual_image = det_demo.visualization(image.copy(), result_polygons, result_masks, result_boxes, result_words)
49
 
50
  cv2.imwrite('result.jpg', visual_image)
51
- return 'result.jpg'#, pd.DataFrame(result_words)
52
 
53
 
54
  iface = gr.Interface(
@@ -56,7 +56,7 @@ iface = gr.Interface(
56
  title="张博强毕设展示",
57
  description="毕设题目:自然场景中任意形状文字的检测与识别\n目前进度:检测",
58
  inputs=[gr.inputs.Image(label="image", type="filepath")],
59
- outputs=[gr.outputs.Image()], #, gr.outputs.Dataframe(headers=['word'])],
60
  #examples=['example1.jpg', 'example2.jpg', 'example3.jpg'],
61
  #article="<a href=\"https://github.com/MhLiao/MaskTextSpotterV3\">GitHub Repo</a>",
62
  ).launch(enable_queue=True)
 
48
  visual_image = det_demo.visualization(image.copy(), result_polygons, result_masks, result_boxes, result_words)
49
 
50
  cv2.imwrite('result.jpg', visual_image)
51
+ return 'result.jpg', pd.DataFrame(result_words)
52
 
53
 
54
  iface = gr.Interface(
 
56
  title="张博强毕设展示",
57
  description="毕设题目:自然场景中任意形状文字的检测与识别\n目前进度:检测",
58
  inputs=[gr.inputs.Image(label="image", type="filepath")],
59
+ outputs=[gr.outputs.Image(), gr.outputs.Dataframe(headers=['word'])],
60
  #examples=['example1.jpg', 'example2.jpg', 'example3.jpg'],
61
  #article="<a href=\"https://github.com/MhLiao/MaskTextSpotterV3\">GitHub Repo</a>",
62
  ).launch(enable_queue=True)
det_demo.py CHANGED
@@ -580,7 +580,7 @@ class DetDemo(object):
580
  green[...,2] = 0
581
  for mask, word, box in zip(masks, words, boxes):
582
  image[mask] = image[mask] * 0.5 + green[mask] * 0.5
583
- cv2.putText(image, word, (box[0], box[1]), cv2.FONT_HERSHEY_COMPLEX, 1, (0,0,255), 2)
584
  '''
585
  for box in boxes:
586
  cv2.rectangle(image,(box[0], box[1]), (box[2], box[3]), (0,0,255), 2)
 
580
  green[...,2] = 0
581
  for mask, word, box in zip(masks, words, boxes):
582
  image[mask] = image[mask] * 0.5 + green[mask] * 0.5
583
+ cv2.putText(image, word, (box[0], box[1]), cv2.FONT_HERSHEY_COMPLEX, 0.4, (0,0,255), 2)
584
  '''
585
  for box in boxes:
586
  cv2.rectangle(image,(box[0], box[1]), (box[2], box[3]), (0,0,255), 2)