Skip to content

This is my final year engineering project which entails the backend program that is able to find Generic brand drug names in an image and export them so they can be translated to their active ingridient name.

Notifications You must be signed in to change notification settings

Jessy1237/DrugNameOCR

Repository files navigation

Required Libraries:

Required Natives:

  • javacpp
  • javacpp leptonica
  • javacpp Tesseract
  • openCV 4

NOTE: Library Natives need to be in the root directory of where the runnable jar is located.

Optional Library for Test Cases:

  • java-string-similarity

Execution:

java -jar DrugNameOCR.jar <execution type> <args>

Execution Types:

There are three different execution paths, OCR (OCR), Spell Correction Addition (SA),Candidate Check (CC) and Create Model (CM).

OCR:

This execution type is for when you want to process an image and extract some drug names with OCR.

ARGS:

"<model dir>" "<HMM path>" "<SpellCOrrectionsMap path>" "<UMLS API key>" "<path to google cloud vision credentials json file>" <img 1 args> <img 2 args>...

Required Files:

  • tesseract data folder "tessdata"
  • DrugName.hmm
  • Your generated model files in a directory

Required Accounts:

  • UMLS - When signing up just say you're on working on a project and they will give you a free login. Took a couple days.
  • Google Cloud Account - They do give a certain amount of units free per month for the google cloud vision API. I think it is around 1000 images a month, after that your account will get charged. You also need to follow some of their documentation on how to enable the permissions for your google cloud account to run the cloud vision api and how to get the json credentials file.
IMG ARGS:
<handler specifier> -I="<img path>"

You can have multiple img args to run multiple img processings at once.

Handler Specifier:
-MG is the manual crop specifier to use the google ocr engine
-AT is the automatic crop specifier to use the tesseract ocr engine

Results:

Will be outputted to the same location as the image and the file will be called ".result"

SA:

This execution type is for when you have ascertained a correct spelling for an original OCR result and want to save it into the spell correction map/dictionary.

ARGS:

"<SpellCorrectionMap path>" <ocr result> <correct spelling>

NOTE: The ocr result and correct spelling arg should only be one word each, it cannot be a sentence.

CC:

This execution type is for when you want to get some confidence levels for candidate drug names when compared to the original ocr result.

ARGS:

<ocr result> <candidate 1> <candidate 2>...

You can have multiple candidate words to check against the original ocr result word.

CM:

This execution type is for when you want to create a template model from an example document image.

ARGS:

"<model directory>" "<image directory>'" "<image name>"...

About

This is my final year engineering project which entails the backend program that is able to find Generic brand drug names in an image and export them so they can be translated to their active ingridient name.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages