Skip to content

delldu/ImageCNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImageCNN

Dataset

  1. Download & unzip pictures under data directory
wget http://download.tensorflow.org/example_images/flower_photos.tgz  

Examples

daisy dandelion roses sunflowers tulips
  1. Split files into two folders: train and test with tools/shuflink cd data
    ../tools/shuflink flower_photos train test
    cd ..

Train

$python train.py -h

Training models are saved under logs. After training, you should move one of them to model directory and rename it as “flower.model“ for evaluation and prediction.

Install visdom

pip install visdom

start visdom

python -m visdom.server &

Start Train

python train.py

Loss and Acc

http://127.0.0.1:8097

Evaluate

$ python eval.py -h

$ python eval.py

Evaluating data information:
Dataset ImageFolder
Number of datapoints: 918
Root Location: data/test
Transforms (if any): Compose(
Resize(size=256, interpolation=PIL.Image.BILINEAR)
CenterCrop(size=(224, 224))
ToTensor()
Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
)
Target Transforms (if any): None
Class names: ['daisy', 'dandelion', 'roses', 'sunflowers', 'tulips']
2018-09-28 15:31:19,234 - model.py[line:203] - INFO: Start evaluating ...
2018-09-28 15:31:21,553 - model.py[line:222] - INFO: Evaluating ACC: 99.24%
2018-09-28 15:31:21,553 - model.py[line:223] - INFO: Evaluating finished.

Predict

python predict.py -h

python predict.py images/daisy_5794835_d15905c7c8_n.jpg

Image class: 0, daisy, 1.00, images/daisy_5794835_d15905c7c8_n.jpg

Requirements

  • Python 3.6

  • Pytorch 0.4.0, 1.0

  • Torchvision 0.2.1

  • Pillow 4.2.1

License

ImageCNN is released under the [Apache 2.0 license]

Chinese Document

通用图像分类器.

Releases

No releases published

Packages

No packages published

Languages