Gogul09 / flower-recognition

🌺🌻 Using state-of-the-art pre-trained Deep Neural Net architectures for Flower Species Recognition
https://gogul09.github.io/software/flower-recognition-deep-learning
MIT License
159 stars 101 forks source link

Very low accuracy results with FLOWERS17 #2

Closed jmettes closed 6 years ago

jmettes commented 7 years ago

Thanks for putting up this code. I'm just a bit confused as to why I'm getting vey low accuracy results from running your code. Any idea where it might be going wrong?

rank-1: 4.66%
rank-5: 28.19%

             precision    recall  f1-score   support

          0       0.09      0.13      0.11        23
          1       0.00      0.00      0.00        23
          2       0.00      0.00      0.00        27
          3       0.04      0.03      0.04        31
          4       0.04      0.03      0.04        29
          5       0.10      0.10      0.10        21
          6       0.06      0.04      0.05        25
          7       0.05      0.04      0.04        26
          8       0.00      0.00      0.00        23
          9       0.00      0.00      0.00        24
         10       0.07      0.05      0.06        21
         11       0.00      0.00      0.00        22
         12       0.08      0.10      0.09        20
         13       0.04      0.03      0.04        30
         14       0.09      0.09      0.09        22
         15       0.04      0.06      0.05        18
         16       0.12      0.13      0.12        23

My conf/config.json

{
        "model"                 : "vgg19",
        "weights"               : "imagenet",
        "include_top"           : false,

        "train_path"            : "/home/ubuntu/flower/flowers",
        "features_path"         : "output/flowers_17/vgg19/features.h5",
        "labels_path"           : "output/flowers_17/vgg19/labels.h5",
        "results"               : "output/flowers_17/vgg19/results.txt",
        "classifier_path"       : "output/flowers_17/vgg19/classifier.cpickle",

        "test_size"             : 0.30,
        "seed"                  : 9,
        "num_classes"           : 17
}

I've downloaded the FLOWERS17 dataset, and ran organize_flowers17.py. It all looks good:

ubuntu@ubuntu:~/flower/flowers$ ls
bluebell   coltsfoot  crocus    daisy      fritillary  lilyvalley  snowdrop   tigerlily  windflower
buttercup  cowslip    daffodil  dandelion  iris        pansy       sunflower  tulip
ubuntu@ubuntu:~/flower/flowers$ ls -l windflower/
total 3568
-rwxr-xr-x 1 ubuntu ubuntu  28427 Jul 23 23:32 image_0006.jpg
-rwxr-xr-x 1 ubuntu ubuntu  41580 Jul 23 23:32 image_0029.jpg
-rwxr-xr-x 1 ubuntu ubuntu  37322 Jul 23 23:32 image_0034.jpg
...

they all seem to have 80 images:

ubuntu@ubuntu:~/flower/flowers$ ls -1 windflower/ | wc -l
80
ubuntu@ubuntu:~/flower/flowers$ ls -1 daisy/ | wc -l
80

the hd5 files seem to be filled:

ubuntu@ubuntu:~/flower/output/flowers_17/vgg19$ ls -l
total 23448
-rw-rw-r-- 1 ubuntu ubuntu  1700188 Jul 24 02:23 classifier.cpickle
-rw-rw-r-- 1 ubuntu ubuntu 22284384 Jul 24 02:07 features.h5
-rw-rw-r-- 1 ubuntu ubuntu    13024 Jul 24 02:07 labels.h5
-rw-rw-r-- 1 ubuntu ubuntu     1040 Jul 24 02:23 results.txt

Interestingly, if I download your output/flowers_17/vgg19/features.h5 and, using that, run train.py I get your results. So it seems like the problem has something to do with extract_features.py

Since I'm using Linux, I had to change a few parts of the code to let me use unix-style paths (e.g., '/' vs '\'). But I don't really see why it should matter since it still seems to be picking up all the files.

Gogul09 commented 6 years ago

Hi, can you please find the updated extract_features.py code. Please uninstall and reinstall Keras using pip. Keras version has been changed to 2.1.2. There are lots of changes in applications module too. So, can you try with the updated code. Also, use HDFView to see whether features are properly extracted or not by opening the features.h5. Kindly let me know if this solved the issue.