<jupyter_start><jupyter_text>Install libraries<jupyter_code>!sudo apt-get install tesseract-ocr
!pip install pytesseract
!git clone https://github.com/OpenMLCo/Yolo-OCR.git
#%cd /content/Yolo-OCR/Yolo-OCR/<jupyter_output><empty_output><jupyter_text>Install Darknet<jupyter_code>!git clone https://github.com/AlexeyAB/darknet
!cp -r /content/darknet/* /content/Yolo-OCR/Yolo-OCR/
#cd darknet/
%cd /content/Yolo-OCR/Yolo-OCR/
# para GPU
!sed -i 's/OPENCV=0/OPENCV=1/g' Makefile
!sed -i 's/GPU=0/GPU=1/g' Makefile
!sed -i 's/CUDNN=0/CUDNN=1/g' Makefile
!sed -i 's/CUDNN_HALF=0/CUDNN_HALF=1/g' Makefile
!sed -i 's/AVX=0/AVX=1/g' Makefile
!sed -i 's/LIBSO=0/LIBSO=1/g' Makefile

# para cpu
# #!sed -i 's/OPENCV=0/OPENCV=1/g' Makefile
# !sed -i 's/AVX=0/AVX=1/g' Makefile
# !sed -i 's/LIBSO=0/LIBSO=1/g' Makefile
# #!sed -i 's/GPU=0/GPU=1/g' Makefile
# #!sed -i 's/CUDNN=0/CUDNN=1/g' Makefile
# #!sed -i 's/CUDNN_HALF=0/CUDNN_HALF=1/g' Makefile

!make
!rm -rf /content/darknet/
!chmod -R +777 /content/Yolo-OCR/Yolo-OCR<jupyter_output><empty_output><jupyter_text>Download weigths<jupyter_code>%cd /content/Yolo-OCR/Yolo-OCR/Yolov4_ID/
!gdown --id 1-q3ND6ixWfsmA2JrSqk0_ZEr5sz-cl-I
%cd /content/Yolo-OCR/Yolo-OCR/Yolov4_RUT/
!gdown --id 1-0pu113A4EiaA4GMYP2Af2yhgFSa8p4h
%cd /content/Yolo-OCR/Yolo-OCR/<jupyter_output>/content/Yolo-OCR/Yolo-OCR<jupyter_text>Extract info ID (cédula)<jupyter_code>!python /content/Yolo-OCR/Yolo-OCR/extract_info_cedula.py --help
# change image!!!
!python extract_info_cedula.py --input_file /content/ceduYohan.jpeg \
  --batch_size 1 --weights /content/Yolo-OCR/Yolo-OCR/Yolov4_ID/yolov4_custom_best.weights \
  --config_file  /content/Yolo-OCR/Yolo-OCR/Yolov4_ID/yolov4_custom.cfg \
  --data_file /content/Yolo-OCR/Yolo-OCR/Yolov4_ID/obj.data \
  --thresh 0.25<jupyter_output>Try to load cfg: /content/Yolo-OCR/Yolo-OCR/Yolov4_ID/yolov4_custom.cfg, weights: /content/Yolo-OCR/Yolo-OCR/Yolov4_ID/yolov4_custom_best.weights, clear = 0 
subdivisions: Using default '1'
 0 : compute_capability = 370, cudnn_half = 0, GPU: Tesla K80 
net.optimized_memory = 0 
mini_batch = 1, batch = 1, time_steps = 1, train = 0 
   layer   filters  size/strd(dil)      input                output
   0 Create CUDA-stream - 0 
 Create cudnn-handle 0 
conv     32       3 x 3/ 1    512 x 512 x   3 ->  512 x 512 x  32 0.453 BF
   1 conv     64       3 x 3/ 2    512 x 512 x  32 ->  256 x 256 x  64 2.416 BF
   2 conv     64       1 x 1/ 1    256 x 256 x  64 ->  256 x 256 x  64 0.537 BF
   3 route  1 		                           ->  256 x 256 x  64 
   4 conv     64       1 x 1/ 1    256 x 256 x  64 ->  256 x 256 x  64 0.537 BF
   5 conv     32       1 x 1/ 1    256 x 256 x  64 ->  256 x 256 x  32 0.268 BF
   6 conv     64       3 x 3/ 1    256 x 256 x  32 ->  256 x 256 x  64 2.416 BF
   7 S[...]<jupyter_text>Extract info RUT<jupyter_code>!python extract_info_RUT.py --help
# change image!!!
!python extract_info_RUT.py --input_file /content/104_registroUnico-764_0.jpg \
  --batch_size 1 --weights /content/Yolo-OCR/Yolo-OCR/Yolov4_RUT/yolov4_custom_best.weights \
  --config_file  /content/Yolo-OCR/Yolo-OCR/Yolov4_RUT/yolov4_custom.cfg \
  --data_file /content/Yolo-OCR/Yolo-OCR/Yolov4_RUT/obj.data \
  --thresh 0.25<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13865030674846626, 'fraction_numerical': 0.07883435582822086, 'mean_word_length': 2.9816849816849818, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 26, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '185809', 'license': 'MIT', 'n_tokens_mistral': 1653, 'n_tokens_neox': 1502, 'n_words': 302, 'path': 'Examples/Extract_info_ID_RUT.ipynb', 'repo_name': 'OpenMLCo/Yolo-OCR', 'size': '3260'}