Open gjwgit opened 6 years ago
Bug for py version on dsvm:
$ ml demo image-classification-py
An error was encountered:
Traceback (most recent call last):
File "demo.py", line 17, in <module>
loaded_model = load_model(top_model_path)
File "/anaconda/envs/py35/lib/python3.5/site-packages/keras/models.py", line 237, in load_model
with h5py.File(filepath, mode='r') as f:
File "/anaconda/envs/py35/lib/python3.5/site-packages/h5py/_hl/files.py", line 269, in __init__
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/anaconda/envs/py35/lib/python3.5/site-packages/h5py/_hl/files.py", line 99, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name = '/home/dlvmadmin/.mlhub/image-classification-py/bottleneck_fc_model.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
Bug for the R version. Probably needs to specify install into the user's ~/R/.... folder for missing packages.
$ ml configure image-classification-r
Configuration will take place using '/home/gjw/.mlhub/image-classification-r/configure.sh'.
An error was encountered:
Installing packages into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages(install) :
'lib = "/usr/local/lib/R/site-library"' is not writable
Error in install.packages(install) : unable to install packages
Execution halted
Another R version issue, once configured:
gjw@dsvm01:~$ ml demo image-classification-r
An error was encountered:
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Loading required package: ggplot2
Error in py_call_impl(callable, dots$args, dots$keywords) :
TypeError: ('Keyword argument not understood:', 'data_format')
Detailed traceback:
File "/anaconda/envs/py35/lib/python3.5/site-packages/keras/models.py", line 243, in load_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/anaconda/envs/py35/lib/python3.5/site-packages/keras/models.py", line 317, in model_from_config
return layer_module.deserialize(config, custom_objects=custom_objects)
File "/anaconda/envs/py35/lib/python3.5/site-packages/keras/layers/__init__.py", line 55, in deserialize
printable_module_name='layer')
File "/anaconda/envs/py35/lib/python3.5/site-packages/keras/utils/generic_utils.py", line 144, in deserialize_keras_object
list(custom_objects.items())))
File "/anaconda/envs/py35/lib/python3.5/site-packages/keras/models.py", line 1349, in from_config
layer = layer_module.deserialize(conf, custom_objects=custom_objects)
File "/anaconda/envs/py35/lib/python3.5/site-packages/keras/layers/__init_
Calls: load_model_hdf5 -> do.call -> <Anonymous> -> py_call_impl -> .Call
Execution halted
I didn't meet the above error message. The results are as shown below:
dlvmadmin@dlvmubuntu03:~$ ml configure image-classification-r Configuration will take place using '/home/dlvmadmin/.mlhub/image-classification-r/configure.sh'. Once configured run the demonstration:
$ ml demo image-classification-r
dlvmadmin@dlvmubuntu03:~$ ml demo image-classification-r
Predict Image Classes
Found 1000 images belonging to 2 classes.
Image Predicted Actual Error
1 cat.1501.jpg 0 0
2 cat.1502.jpg 0 0
3 cat.1503.jpg 0 0
4 cat.1504.jpg 0 0
5 cat.1505.jpg 1 0 <----
6 cat.1506.jpg 0 0
7 cat.1507.jpg 0 0
8 cat.1508.jpg 1 0 <----
9 cat.1509.jpg 1 0 <----
10 cat.1510.jpg 1 0 <----
11 cat.1511.jpg 1 0 <----
12 cat.1512.jpg 1 0 <----
13 cat.1513.jpg 1 0 <----
14 cat.1514.jpg 1 0 <----
15 cat.1515.jpg 0 0
16 cat.1516.jpg 0 0
17 cat.1517.jpg 1 0 <----
18 cat.1518.jpg 1 0 <----
19 cat.1519.jpg 0 0
20 cat.1520.jpg 0 0
Model Loss and Accuracy
$loss [1] 0.2575455
$acc [1] 0.89
Confusion Matrix
Confusion Matrix and Statistics
Reference
Prediction 0 1 0 230 252 1 270 248
Accuracy : 0.478
95% CI : (0.4466, 0.5095)
No Information Rate : 0.5
P-Value [Acc > NIR] : 0.9227
Kappa : -0.044
Mcnemar's Test P-Value : 0.4568
Sensitivity : 0.4960
Specificity : 0.4600
The results for image-classification-py are as shown below:
dlvmadmin@dlvmubuntu03:~$ ml demo image-classification-py Found 1000 images belonging to 2 classes.
Predict image classes
Image Predicted Actual
0 cat.1947.jpg 0 0 1 cat.1990.jpg 0 0 2 cat.1642.jpg 0 0 3 cat.1999.jpg 0 0 4 cat.1513.jpg 0 0 5 cat.1508.jpg 1 0 6 cat.1540.jpg 1 0 7 cat.1673.jpg 0 0 8 cat.1638.jpg 0 0 9 cat.1913.jpg 0 0 10 cat.1908.jpg 0 0 11 cat.1664.jpg 0 0 12 cat.1570.jpg 0 0 13 cat.1720.jpg 0 0 14 cat.1746.jpg 0 0 15 cat.1560.jpg 0 0 16 cat.1979.jpg 0 0 17 cat.1937.jpg 0 0 18 cat.1639.jpg 0 0 19 cat.1976.jpg 0 0
Accuracy
50/50 [==============================] - 2s 44ms/step acc: 87.00%
Confusion Matrix
[[412 88] [ 42 458]] dlvmadmin@dlvmubuntu03:~$
Package the keras/tensorflow cats/dog image classification model.
https://www.datasciencecentral.com/profiles/blogs/dogs-vs-cats-image-classification-with-deep-learning-using
https://tensorflow.rstudio.com/blog/keras-image-classification-on-small-datasets.html