Based on dataset training_ According to the structure provided, CNN model is established to identify the cat / dog in the picture and calculate the prediction accuracy:
1_ Set test data prediction accuracy
2
When building CNN model to identify the cat / dog in the picture, through the load in keras under the framework of tensorflow_ Img() encountered the following error when loading the picture:
ImportError: Could not import PIL.Image. The use of array_to_img requires PIL.Image
Find solutions through the Internet and try them in person. The solutions are as follows:
the main reason is that pilot is not installed because load is used_ The img() function requires pilot
(base) C:\Users\Administrator>activate tensorflow
(tensorflow) C:\Users\Administrator>pip3 install pillow
Collecting pillow
Downloading Pillow-7.2.0-cp36-cp36m-win_amd64.whl (2.0 MB)
|████████████████████████████████| 2.0 MB 7.4 kB/s
Installing collected packages: pillow
Successfully installed pillow-7.2.0
The problem has been solved.
Refer to
1. Importerror: could not import PIL.Image . The use ofarray_ to_ img
requires PIL.
2.ImportError: Could not import PIL.Image . The use ofarray_ to_ img
requires PIL.
Read More:
- On the problem of from PIL import image
- Python failed to use PIL writer library. TTF, etc. oserror: cannot open resource
- Mac python install PIL
- matplotlib 1.3.1 requires nose, which is not installed. matplotlib 1.3.1 requires tornado, which is
- Array of PHP_ diff,array_ intersect,array_ merge, in_ Is there a limit on the number of arrays in array?
- error: XML error: target ‘vdb‘ duplicated for disk sources ‘aaa.img‘ and ‘bbb.img‘
- How to use C + + function pointer array
- ValueError: check_ hostname requires server_ The solution record of the host name
- How to use C # to get image format without system. Drawing. Common
- nvalid default value for prop “params“: Props with type Object/Array must use a factory function to
- [Solved] caffe Error: Check failed: cv_img.data Could not load
- Solution to null pointer error in array
- [solved] error: valueerror: expected 2D array, got scalar array instead
- Ant Design upload listtype = “picture card” realizes multi image upload and click preview image encapsulation
- Leetcode solution 189 Rotate Array Java version
- pip Import Error:cannot import Name main solution
- How to use Python split() function (split array)
- Two dimensional array and pointer to one dimensional array
- IMG tag onerror event resolves infinite loop error reporting
- Ueditor paste word image and upload image file automatically