Keras implementation of Faster R-CNN to classify text into Machine Printed and Handwritten Text
- numpy
$ pip install numpy
- h5py
$ pip install h5py
- opencv-python
$ pip install opencv-python
- sklearn
$ pip install scikit-learn
- Keras==2.0.3 (Both theano and tensorflow backends are supported. However tensorflow is recommended)
$ pip install Keras==2.0.3
- Tensorflow
$ pip install Tensorflow
Trained model can be downloaded from: https://drive.google.com/drive/folders/1eymjiH7_oWJbSI4LOAVhMzzNFtkbYcPz?usp=sharing
-
Copy pretrained weights for resnet50 (resnet50_weights_tf_dim_ordering_tf_kernels.h5) in Style-Classification directory.
-
train_frcnn.py
can be used to train a model. To train the data, it must be in PASCAL VOC format. To train simply do:
$ python train_frcnn.py -p /path/to/train_data/
- Running
train_frcnn.py
will write weights to disk to an hdf5 file, as well as all the setting of the training run to apickle
file. These settings can then be loaded bytest_frcnn.py
for any testing.
-
Copy trained model(model_frcnn.hd5) and config.pickle file in Style-Classification diectory.
-
test_frcnn.py
can be used to perform inference, given pretrained weights and a config file. Specify a path to the folder containing images:
$ python test_frcnn.py -p /path/to/test_data/
This code is inspired from https://github.com/yhenon/keras-frcnn