This repository contains the code for the Deep Learning system for text detection and recognition in Cosmetic images.
our system is OCR models locate Text, recognition them, the product name is detected from the recognized characters, and the most similar product is searched for in the product database.
If you use our code, please use it after installation through the .yaml file we uploaded
- This work was tested with PyTorch 1.10.1, CUDA 11.2, python 3.7, django 3.2.11, djangorestframework 3.13.1, django-extensions 3.1.5 and Ubuntu 18.04.3 LTS.
You must need `conda env create --file environment.yaml`.
- Download the trained models
Model name | Languages | Purpose | Model Link |
---|---|---|---|
craft_mlt_25k | Eng + MLT | Text detection | Click |
best_accuracy | Eng + Kor | Text recognition | Click |
- Run with pretrained model
1. Download pretrained model craft_mlt_25k and best_accuracy
2. Move craft_mlt_25k into `atoOCR/craftPytorch/`
3. Move best_accuracy into `atoOCR/`
4. Modify database path name, user, passwd and etc in `demo/config/settings.py`.
5. python ./jsonToDB/demo/manage.py runserver [your ip:port]
- Test with cosmetics image(This work is a test method at Postman.
Launch Postman by clicking on the logo. After it completely loads the ㅣmain screen follow these steps to create your collection of requests:
1. On the “collections” tab click on the “+” button to create a new collection. A new collection will appear and you will be able to edit its name, description, and many other settings.
2. Then right click on that new collection and select “add request” to create your first request.
3. Select the recently created request and enter the API endpoint(ex. http://your ip :port/api) where it says ‘Enter request URL’ and select the method (the action type POST ) on the left of that field.
4. Enter a POST body(key is 'media' and Value is 'cosmetic image')
5. If you execute this API now, hit the ‘Send’ button, which is located to the right of the API request field. You can also click on the ‘Save’ button beside it to save that API request to your library.
demo images | json results | cosmetics matching success in database |
---|---|---|
Json_File | O | |
Json_File | O | |
Json_File | O | |
Json_File | X | |
Json_File | O | |
Json_File | O | |
Json_File | O | |
Json_File | O | |
Json_File | X | |
Json_File | O |
This implementation has been based on these repository CRAFT-pytorch, deep-text-recognition-benchmark.