A deep learning model to separate Handwritten notes and non notes images with Python and Tensorflow.
- Python 3.6+
- TensorFlow 2.0+
- OpenCV 4.0+
- Numpy
- Json
- Clone this repository to your local machine.
- Install the required packages listed in the
requirements.txtfile by runningpip install -r requirements.txt. - Place the images you want to classify in the
test_imagesdirectory. - Put your model in the
modelsdirectory. The model should be saved in the.h5format. - Run the
NotesSeparator.pyscript to classify the images:NotesSeparator.ipynbif you are running in Jupyter Notebook. - The classified images will be saved in the
outputdirectory.
├── classify_notes.py ├── models │ └── notesmodel.h5 ├── output │ ├── non_notes │ ├── notes │ └── results │ ├── image1.png │ ├── image1.json │ ├── image2.png │ ├── image2.json │ └── results.json ├── README.md └── test_images ├── image1.jpg └── image2.jpg
The model used for this project is a Convolutional Neural Network (CNN) with the following layers:
- Conv2D layer with 16 filters and a kernel size of (3,3)
- MaxPooling2D layer
- Conv2D layer with 32 filters and a kernel size of (3,3)
- MaxPooling2D layer
- Conv2D layer with 16 filters and a kernel size of (3,3)
- MaxPooling2D layer
- Flatten layer
- Dense layer with 256 neurons
- Dense layer with 1 neuron (output layer) with a sigmoid activation function
The classified images are saved in either the notes or non_notes directory in the output folder depending on their classification. Additionally, a results.json file is created in the output/results folder that contains the results of the classification for each image.
Contributions are welcome. Please fork the repository and submit a pull request.
This project is licensed under the MIT License.