This repo contains programs that are used in the experiment of paper: Batik Classification using Deep Convolutional Network Transfer Learning
Indonesian Batik classification using VG16 convolutional neural network (CNN) as feature extractor + softmax as classifier.
Our dataset consists of 5 batik classes where each images will belong to exactly one class:
- Parang: parang (traditional blade) motifs
- Lereng: also blade-like pattern but less pointy than Parang
- Ceplok: repetition of geometrical motif shapes (eg. rectangle, square, ovals, stars)
- Kawung: kawung fruits motif
- Nitik: flowers-like motifs
To run the experiments, you would need:
- CUDA device with global RAM >= 4 GB (tested with GTX 980)
- Python 2.7.x
- Virtualenv (optional. For isolated environment)
The programs can also run on CPU. You just need to use
tensorflow
instead oftensorflow-gpu
. Further info https://www.tensorflow.org/install/
The programs expect batik image files (jpg/png) to be grouped by their classes. In this experiment, below directory structures are used:
train_data_dir/
Ceplok/*.jpg
Kawung/*.jpg
Lereng/*.jpg
Nitik/*.jpg
Parang/*.jpg
test_data_dir/
Ceplok/*.jpg
Kawung/*.jpg
Lereng/*.jpg
Nitik/*.jpg
Parang/*.jpg
Install dependencies: pip install -r requirements.txt
The following commands execute these steps:
- Convert images dataset to vector h5 format:
- Extract features from dataset (still in h5 format)
- Train & evaluate variations of NN (vary by number of hidden layers and activation function) with cross validation
python preprocess.py train_data_dir --vector_file train.h5
python preprocess.py test_data_dir --vector_file test.h5
python extractor.py train.h5 --features_file train.features.h5
python extractor.py test.h5 --features_file test.features.h5
python evaluate.py train.features.h5 test.features.h5
For more options run each file with -h
option. eg: python preprocess.py -h
Process time is around 40 minutes with GTX 980 4 GB
Follow the same steps as VGG16 + Softmax NN, but use evaluate_sklearn.py
instead of evaluate.py
:
python preprocess.py train_data_dir --vector_file train.h5
python preprocess.py test_data_dir --vector_file test.h5
python extractor.py train.h5 --features_file train.features.h5
python extractor.py test.h5 --features_file test.features.h5
python evaluate_sklearn.py train.features.h5 test.features.h5
The following command executes these steps:
- Extract SIFT descriptors from images
- Cluster descriptors to build vocabulary using K-means
- Extract bag of words features from images using vocabulary
- Train & evaluate 6 classifiers with cross validation
python siftbow.py train_data_dir test_data_dir
For more options run each file with -h
option. eg: python siftbow.py -h
Process time is around 52 minutes with Intel Core i7 5500U 8 GB RAM
The following command executes these steps:
- Extract SURF descriptors from images
- Cluster descriptors to build vocabulary using K-means
- Extract bag of words features from images using vocabulary
- Train & evaluate 6 classifiers with cross validation
python surfbow.py train_data_dir test_data_dir
For more options run each file with -h
option. eg: python surfbow.py -h
Process time is around 45 minutes with Intel Core i7 5500U 8 GB RAM
To cite our research or dataset, please use this citation:
@article{gultom2018batik,
title={Batik Classification using Deep Convolutional Network Transfer Learning},
author={Gultom, Yohanes and Arymurthy, Aniati Murni and Masikome, Rian Josua},
journal={Jurnal Ilmu Komputer dan Informasi},
volume={11},
number={2},
pages={59--66},
year={2018}
}