Giter VIP home page Giter VIP logo

ocr-for-medical-laboratory-reports's Introduction

OCR-for-Medical-Laboratory-Reports

Test code for text detection and recognition from images of medical laboratory reports. The results may have some deviation on different devices.

The text detection module is forked from endernewton. We improve the results through a patch-based strategy. The text recognition module is implemented according to meijieru. A concatenation structure is designed to utilize both the shallow and deep features, which results in a higher accuracy.

Text detection

  1. Download the dataset from Google Drive.
  2. Extract the .zip file and put them under "./detection/data/VOCdevkit2007/". Then the folder should be:
    ├── detection
     ├── data
       ├── VOCdevkit2007
         ├── VOC2007
           ├── Annotations
           ├── ImageSets
           ├── JPEGImages
           ├── editAnnotation.py
           ├── labels_src.json
    
  3. Download the model from Google Drive.
  4. Extract the .zip file and put them under "./detection/output/". Then the folder should be:
    ├── detection
     ├── output
       ├── vgg16
         ├── voc_2007_test
         ├── voc_2007_trainval
    
  5. This framwork has been tested under Tensorflow 1.0. Update your -arch in setup script to match your GPU.
    cd detection/lib
    # Change the GPU architecture (-arch) if necessary
    vim setup.py
    # TitanX (Maxwell/Pascal)	sm_52
    # GTX 960M	sm_50
    # GTX 1080 (Ti)	sm_61
    # Tesla K80 (AWS p2.xlarge)	sm_37
    
  6. Modify the GPU number before test.
    cd detection/tools
    vim printResults_with_crop.py
    
    33 os.environ['CUDA_VISIBLE_DEVICES']='1'
    
    Then, run "printResults_with_crop.py" under Tensorflow environment:
    cd ..
    python ./tools/printResults_with_crop.py --net vgg16 --dataset pascal_voc
    
    A result file will be created as "detection/tools/results.txt"
  7. Evaluaiton the results:
    python ./tools/eval_results.py
    

Text Recognition

  1. Download val set from Google Drive.
  2. The test set has been transformed as LMDB format. Extract the .zip file and put them under "./recognition/data/val". Then the folder should be:
    ├── recognition
     ├── data
       ├── val
         ├── data.mdb
         ├── lock.mdb
    
  3. Download the model from Google Drive.
  4. Put "netCRNN_L3.pth" under "./recognition/output/". Then the folder should be:
    ├── recognition
     ├── output
       ├── netCRNN_L3.pth
    
  5. Dependence: Pytorch 0.2 and warp_ctc_pytorch.
  6. Modify the GPU number before test.
    cd recognition
    vim eval.py
    
    16 os.environ['CUDA_VISIBLE_DEVICES']='1'
    
    Then, run "eval.py":
    python eval.py
    

ocr-for-medical-laboratory-reports's People

Contributors

xuewenyuan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.