SengTak commited on
Commit
6f5b6e8
·
1 Parent(s): 70fea66

test omitting PPOCR

Browse files
Files changed (2) hide show
  1. app_pages/ocr_comparator.py +23 -17
  2. requirements.txt +2 -2
app_pages/ocr_comparator.py CHANGED
@@ -246,10 +246,12 @@ def app():
246
  with st.spinner("EasyOCR reader initialization in progress ..."):
247
  reader_easyocr = init_easyocr([in_list_params[0][0]])
248
 
 
249
  # - PPOCR
250
  # Paddleocr
251
  with st.spinner("PPOCR reader initialization in progress ..."):
252
  reader_ppocr = init_ppocr(in_list_params[1])
 
253
 
254
  # - MMOCR
255
  with st.spinner("MMOCR reader initialization in progress ..."):
@@ -470,7 +472,7 @@ def app():
470
  else:
471
  easyocr_boxes_coordinates = easyocr_status
472
  ##
473
-
474
  ## ------- PPOCR Text detection
475
  with st.spinner('PPOCR Text detection in progress ...'):
476
  ppocr_boxes_coordinates, ppocr_status = ppocr_detect(_in_list_readers[1], in_image_path)
@@ -481,6 +483,7 @@ def app():
481
  else:
482
  ppocr_image_detect = ppocr_status
483
  ##
 
484
 
485
  ## ------- MMOCR Text detection
486
  with st.spinner('MMOCR Text detection in progress ...'):
@@ -589,8 +592,8 @@ def app():
589
 
590
  list_text_easyocr = []
591
  list_confidence_easyocr = []
592
- list_text_ppocr = []
593
- list_confidence_ppocr = []
594
  list_text_mmocr = []
595
  list_confidence_mmocr = []
596
 
@@ -602,12 +605,13 @@ def app():
602
  list_text_easyocr, list_confidence_easyocr, status_easyocr = \
603
  easyocr_recog(list_cropped_images, in_list_readers[0], in_list_dict_params[0])
604
  ##
605
-
606
  # Recognize with PPOCR
607
  with st.spinner('PPOCR Text recognition in progress ...'):
608
  list_text_ppocr, list_confidence_ppocr, status_ppocr = \
609
  ppocr_recog(list_cropped_images, in_list_dict_params[1])
610
  ##
 
611
 
612
  # Recognize with MMOCR
613
  with st.spinner('MMOCR Text recognition in progress ...'):
@@ -625,14 +629,15 @@ def app():
625
  out_df_results = pd.DataFrame({'cropped_image': list_cropped_images,
626
  'text_easyocr': list_text_easyocr,
627
  'confidence_easyocr': list_confidence_easyocr,
628
- 'text_ppocr': list_text_ppocr,
629
- 'confidence_ppocr': list_confidence_ppocr,
630
  'text_mmocr': list_text_mmocr,
631
  'confidence_mmocr': list_confidence_mmocr
632
  }
633
  )
634
 
635
- out_list_reco_status = [status_easyocr, status_ppocr, status_mmocr, status_tesseract]
 
636
 
637
  return out_df_results, out_df_results_tesseract, out_list_reco_status
638
 
@@ -674,21 +679,21 @@ def app():
674
  progress_bar.empty()
675
 
676
  return out_list_text_easyocr, out_list_confidence_easyocr, out_status
677
-
678
  ###
679
  #@st.experimental_memo(suppress_st_warning=True, show_spinner=False)
680
  @st.cache_data
681
  def ppocr_recog(in_list_images, in_params):
682
- """Recognition with PPOCR
683
 
684
- Args:
685
- in_list_images (list) : list of cropped images
686
- in_params (dict) : parameters for recognition
687
 
688
- Returns:
689
- list : list of recognized text
690
- list : list of recognition confidence
691
- string/Exception : recognition status
692
  """
693
  ## ------- PPOCR Text recognition
694
  out_list_text_ppocr = []
@@ -714,6 +719,7 @@ def app():
714
  progress_bar.empty()
715
 
716
  return out_list_text_ppocr, out_list_confidence_ppocr, out_status
 
717
 
718
  ###
719
  #@st.experimental_memo(suppress_st_warning=True, show_spinner=False)
@@ -951,7 +957,7 @@ def app():
951
  process_detect.clear()
952
  get_cropped.clear()
953
  easyocr_recog.clear()
954
- ppocr_recog.clear()
955
  mmocr_recog.clear()
956
  tesserocr_recog.clear()
957
 
 
246
  with st.spinner("EasyOCR reader initialization in progress ..."):
247
  reader_easyocr = init_easyocr([in_list_params[0][0]])
248
 
249
+ """
250
  # - PPOCR
251
  # Paddleocr
252
  with st.spinner("PPOCR reader initialization in progress ..."):
253
  reader_ppocr = init_ppocr(in_list_params[1])
254
+ """
255
 
256
  # - MMOCR
257
  with st.spinner("MMOCR reader initialization in progress ..."):
 
472
  else:
473
  easyocr_boxes_coordinates = easyocr_status
474
  ##
475
+ """
476
  ## ------- PPOCR Text detection
477
  with st.spinner('PPOCR Text detection in progress ...'):
478
  ppocr_boxes_coordinates, ppocr_status = ppocr_detect(_in_list_readers[1], in_image_path)
 
483
  else:
484
  ppocr_image_detect = ppocr_status
485
  ##
486
+ """
487
 
488
  ## ------- MMOCR Text detection
489
  with st.spinner('MMOCR Text detection in progress ...'):
 
592
 
593
  list_text_easyocr = []
594
  list_confidence_easyocr = []
595
+ #list_text_ppocr = []
596
+ #list_confidence_ppocr = []
597
  list_text_mmocr = []
598
  list_confidence_mmocr = []
599
 
 
605
  list_text_easyocr, list_confidence_easyocr, status_easyocr = \
606
  easyocr_recog(list_cropped_images, in_list_readers[0], in_list_dict_params[0])
607
  ##
608
+ """
609
  # Recognize with PPOCR
610
  with st.spinner('PPOCR Text recognition in progress ...'):
611
  list_text_ppocr, list_confidence_ppocr, status_ppocr = \
612
  ppocr_recog(list_cropped_images, in_list_dict_params[1])
613
  ##
614
+ """
615
 
616
  # Recognize with MMOCR
617
  with st.spinner('MMOCR Text recognition in progress ...'):
 
629
  out_df_results = pd.DataFrame({'cropped_image': list_cropped_images,
630
  'text_easyocr': list_text_easyocr,
631
  'confidence_easyocr': list_confidence_easyocr,
632
+ #'text_ppocr': list_text_ppocr,
633
+ #'confidence_ppocr': list_confidence_ppocr,
634
  'text_mmocr': list_text_mmocr,
635
  'confidence_mmocr': list_confidence_mmocr
636
  }
637
  )
638
 
639
+ #out_list_reco_status = [status_easyocr, status_ppocr, status_mmocr, status_tesseract]
640
+ out_list_reco_status = [status_easyocr, status_mmocr, status_tesseract]
641
 
642
  return out_df_results, out_df_results_tesseract, out_list_reco_status
643
 
 
679
  progress_bar.empty()
680
 
681
  return out_list_text_easyocr, out_list_confidence_easyocr, out_status
682
+ """
683
  ###
684
  #@st.experimental_memo(suppress_st_warning=True, show_spinner=False)
685
  @st.cache_data
686
  def ppocr_recog(in_list_images, in_params):
687
+ """#Recognition with PPOCR
688
 
689
+ #Args:
690
+ # in_list_images (list) : list of cropped images
691
+ # in_params (dict) : parameters for recognition
692
 
693
+ #Returns:
694
+ # list : list of recognized text
695
+ # list : list of recognition confidence
696
+ # string/Exception : recognition status
697
  """
698
  ## ------- PPOCR Text recognition
699
  out_list_text_ppocr = []
 
719
  progress_bar.empty()
720
 
721
  return out_list_text_ppocr, out_list_confidence_ppocr, out_status
722
+ """
723
 
724
  ###
725
  #@st.experimental_memo(suppress_st_warning=True, show_spinner=False)
 
957
  process_detect.clear()
958
  get_cropped.clear()
959
  easyocr_recog.clear()
960
+ #ppocr_recog.clear()
961
  mmocr_recog.clear()
962
  tesserocr_recog.clear()
963
 
requirements.txt CHANGED
@@ -9,11 +9,11 @@ Pillow
9
  mmcv-full --no-binary mmcv-full
10
  mmdet==2.28.2
11
  mmocr==0.6.3
12
- paddlepaddle==2.4.0rc0
13
  numpy==1.23.4
14
  mycolorpy==1.5.1
15
  plotly==5.10.0
16
  plotly-express==0.4.1
17
  pytesseract==0.3.10
18
  streamlit_option_menu
19
- paddleocr
 
9
  mmcv-full --no-binary mmcv-full
10
  mmdet==2.28.2
11
  mmocr==0.6.3
12
+ #paddlepaddle==2.4.0rc0
13
  numpy==1.23.4
14
  mycolorpy==1.5.1
15
  plotly==5.10.0
16
  plotly-express==0.4.1
17
  pytesseract==0.3.10
18
  streamlit_option_menu
19
+ #paddleocr