The project creates the models and service API for predicting scanned document images' angles ranging between -90° (counter clockwise) to 90° (clockwise) from the vertical.
conda env create -f conda_env.yml -p <path of env>
conda activate <env_name>
pip install -r requirements.txt
-
Dataset preparation
-
Convert PDF documents to images.
-
Download scanned document images from website.
-
Etc.
-
-
Data augmentation (Coming soon)
python src/data_augmentation.py
-
Save dataset to Torch format (.pt) (Coming soon)
python src/create_dataset.py
-
Training
4.1 Edit dataset path
4.2 Training
python src/training.py
4.3 TensorBoard Running
tensorboard --logdir=<log dir> --port <port> tensorboard --logdir=runs --port 8000
Download rotation_net.onnx into models/
-
Start up application by running.
docker-compose up
Or
docker-compose -f .\docker-compose.yml up
-
Open http://127.0.0.1:9000/docs API documentation.
-
Send POST Request to http://127.0.0.1:9000/angle or api_endpoint/angle with Json format.
{ "image" : "image_base_64" }
-
Response is angle in range from -90° to 90° (counter clockwise to clockwise).
{ "angle": 0.7157974243164062 }
Success Cases | Failed Cases |
---|---|
-
Add data_augmentation script
-
Add create dataset script
-
Impove model accuracy
Anyone's participation is welcome! Open an issue or submit PRs.