By looking inside the Deep-Learning-with-Keras_v1.0.3.zip download, you can see that 1.PNG exists inside of the data/MobileNet-samples folder. Ensure that you've extracted the zip contents and that you're running your notebook from inside the Deep-Learning-with-Keras_v1.0.3 directory so that it can access the correct nested data/MobileNet-samples/1.PNG path.
2021-07-29 04:25:43 +0000 UTC
FileNotFoundError Traceback (most recent call last)
in
4 #TO DO-sign up for deeplizard hivemind and get access to the file
5 from IPython.display import Image
----> 6 Image(filename='data/MobileNet-samples/1.PNG', width=300, height=200)
the error is that it states no 'data/MobileNet-samples/1.PNG' file exists. I have downloaded the above deep-learning-with-keras version 3 which is currently
on my mac's downloads folder. I was following along in the 17th lecture. What am I missing?
2021-07-28 17:03:34 +0000 UTC
I am having an issue which is generating the below error message
2021-07-28 16:59:09 +0000 UTC
Hey Bede - For this file, I assume you're attempting to follow one of the Flask tutorials. In the code download titled Deep-Learning-with-Keras_v1.0.3.zip on this post, check the README.txt file inside the flask_apps directory. The h5 file was too large to upload to Patreon, so the readme file has a Google Docs link where you can download it.
2021-07-27 13:49:53 +0000 UTC
I am trying to follow through one of the tutorial and I can't seem to find the 'VGG16_cats_and_dogs.h5' file anywhere in the resources.
2021-07-27 12:15:23 +0000 UTC
AttributeError Traceback (most recent call last)
in
2 # The `5% of younger individuals who did experience side effects
3 random_younger = randint(13,64)
----> 4 train_samples.append(random_younger)
5 train_labels.append(1)
6
AttributeError: 'numpy.ndarray' object has no attribute 'append'
2021-07-02 22:10:45 +0000 UTC
Hello, I was following through the youtube video and manually learning the procedure for the first example where the samples contains a bunch of integers ranging from 13 to 100 and then the labels list corresponds to each of these individuals with ages 13 to 100 (the labels corresponding to the side effects). However, after running the code I ran across these issues, I would be very grateful if you could guide me through the process.
2021-07-02 22:10:22 +0000 UTC
Hi Paola - This error may be triggered if your machine is running out of memory. If you look in the terminal where you're running Jupyter Notebook, you may see additional error messages that might give more info about the problem.
If it is a memory issue, you can reduce the batch size to see if that prevents the notebook kernel from dying. Before doing this, shut down Jupyter from the terminal and restart it first to make sure you free up any memory it might still be hanging on to. Then, experiment with reduced batch size numbers and attempt to train. Start with a number much lower at first to indicate whether memory is the issue, and then you can experiment with increasing it afterward.
Also, be sure at the top of the CNN section of the notebook that you have run the cell to configure GPU memory growth. I pasted the contents of that cell below for reference.
physical_devices = tf.config.experimental.list_physical_devices('GPU')
print("Num GPUs Available: ", len(physical_devices))
tf.config.experimental.set_memory_growth(physical_devices[0], True)
2021-06-26 04:28:50 +0000 UTC
I keep geting a "The kernel appears to have died. It will restart automatically" message when I run the model.fit line while running the CNN part, as of 25/06/2021, I'm running it on jupyter notebook, windows 10, with nvidia GPU. I tried conda install numpy/mlk/tensorflow/keras but none of it worked. Why does this keep happening?
2021-06-26 00:37:19 +0000 UTC
Hey Andres - Is your image JPG or PNG? If JPG, you need to change line 27 shown in the episode below from "png" to "jpeg"
https://deeplizard.com/learn/video/eCz_DTtUBfo
2021-04-19 06:33:34 +0000 UTC
POST http://localhost:5000/predict 500 (INTERNAL SERVER ERROR) in the google console.
File "C:\Users\AndresG\predict_app.py", line 37, in predict
image = Image.open(io.BytesIO(decoded))
File "C:\Users\AndresG\anaconda3\lib\site-packages\PIL\Image.py", line 2930, in open
raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001D277F2CD10>
2021-04-18 11:45:27 +0000 UTC
Hello Deeplizard. Thanks for sharing this information. I have tried all your recommendation, but the following mistake appears
2021-04-18 11:44:46 +0000 UTC
Hey Paola - It appears that either your image data is not placed in the correct directories, or there is an issue with the path to the data. Please check the following:
*From within the same directory where your notebook/py file resides*, check in file explorer that you have the nested directory structure:
data/dogs-vs-cats/train
Within the train directory, you should have a cat directory that contains cat images, and you should have a dog directory that contains dog images.
2021-04-02 12:20:35 +0000 UTC
Hello! I'm in the chapter called image preparation for CNN's for tensorflow with keras and I get 0 images found on the directories like this:
runfile('C:/Users/payol/Documents/Ing A 7mo semestre/Servicio social/python/convolutedNeuralNetwork.py', wdir='C:/Users/payol/Documents/Ing A 7mo semestre/Servicio social/python')
Found 0 images belonging to 2 classes.
Found 0 images belonging to 2 classes.
Found 0 images belonging to 2 classes.
Why is that?
2021-04-02 00:19:14 +0000 UTC
Hi Neeral - Just posting here for anyone else who may view this. As you let me know in a DM, you were running py3.9.1, which currently isn't compatible with h5py. You downgraded to python 3.8 and were able to run load_model successfully afterwards.
2021-01-18 05:32:01 +0000 UTC
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
in
1 from tensorflow.python.keras.models import load_model
----> 2 new_model = load_model('models/medical_trial_model.h5')
~/.local/share/virtualenvs/user-4n4pq1tQ/lib/python3.9/site-packages/tensorflow/python/keras/_impl/keras/engine/saving.py in load_model(filepath, custom_objects, compile)
203 """
204 if h5py is None:
--> 205 raise ImportError('`load_model` requires h5py.')
206
207 if not custom_objects:
ImportError: `load_model` requires h5py.
2021-01-18 02:22:34 +0000 UTC
The "error in loading saved optimizer" is only a warning and should not interfere with your ability to use your loaded model for predicting on new data. You should still be able to use the loaded model without issue.
2021-01-13 06:16:46 +0000 UTC
C:\Users\Mete\Anaconda3\envs\gpuuu\lib\site-packages\keras\engine\saving.py:384: UserWarning: Error in loading the saved optimizer state. As a result, your model is starting with a freshly initialized optimizer.
warnings.warn('Error in loading the saved optimizer '
2021-01-13 01:16:27.409744: W tensorflow/stream_executor/gpu/redzone_allocator.cc:312] Internal: Invoking GPU asm compilation is supported on Cuda non-Windows platforms only
Relying on driver to perform ptx compilation. This message will be only logged once.
predict button not working I'm impatient to discuss this topic
2021-01-12 22:19:56 +0000 UTC
What line of code is throwing the error?
2021-01-12 05:07:00 +0000 UTC
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x00000249B3F64948>
uhh why i am getting this error?
2021-01-11 16:36:42 +0000 UTC
The numpy error you mentioned suggests that you don't have numpy installed in the Python environment where your Flask app is running. Please install numpy, re-start the Flask app, and see if the issue is resolved.
2020-09-11 13:20:08 +0000 UTC
AttributeError Traceback (most recent call last)
in
16
17 print(" * Loading Keras model...")
---> 18 get_model()
19
20 @app.route("/predict", methods=["POST"])
in get_model()
3 def get_model():
4 global model
----> 5 model = load_model('VGG16_cats_and_dogs.h5')
6 print(" * Model loaded!")
7
~\anaconda3.7\envs\py3-TF2.0\lib\site-packages\tensorflow\python\keras\saving\save.py in load_model(filepath, custom_objects, compile)
182 if (h5py is not None and (
183 isinstance(filepath, h5py.File) or h5py.is_hdf5(filepath))):
--> 184 return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
185
186 if sys.version_info >= (3, 4) and isinstance(filepath, pathlib.Path):
~\anaconda3.7\envs\py3-TF2.0\lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py in load_model_from_hdf5(filepath, custom_objects, compile)
176 model_config = json.loads(model_config.decode('utf-8'))
177 model = model_config_lib.model_from_config(model_config,
--> 178 custom_objects=custom_objects)
179
180 # set weights
~\anaconda3.7\envs\py3-TF2.0\lib\site-packages\tensorflow\python\keras\saving\model_config.py in model_from_config(config, custom_objects)
53 '`Sequential.from_config(config)`?')
54 from tensorflow.python.keras.layers import deserialize # pylint: disable=g-import-not-at-top
---> 55 return deserialize(config, custom_objects=custom_objects)
56
57
~\anaconda3.7\envs\py3-TF2.0\lib\site-packages\tensorflow\python\keras\layers\serialization.py in deserialize(config, custom_objects)
107 module_objects=globs,
108 custom_objects=custom_objects,
--> 109 printable_module_name='layer')
~\anaconda3.7\envs\py3-TF2.0\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
360 config = identifier
361 (cls, cls_config) = class_and_config_for_serialized_keras_object(
--> 362 config, module_objects, custom_objects, printable_module_name)
363
364 if hasattr(cls, 'from_config'):
~\anaconda3.7\envs\py3-TF2.0\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py in class_and_config_for_serialized_keras_object(config, module_objects, custom_objects, printable_module_name)
323 cls_config = config['config']
324 deserialized_objects = {}
--> 325 for key, item in cls_config.items():
326 if isinstance(item, dict) and '__passive_serialization__' in item:
327 deserialized_objects[key] = deserialize_keras_object(
AttributeError: 'list' object has no attribute 'items'
2020-09-10 14:11:02 +0000 UTC
That's the error I get, it worked when I used "python -m flask run", however the predict_app.py always comes back with : ModuleNotFoundError: No module named 'numpy'
2020-09-10 14:08:42 +0000 UTC
flask : The term 'flask' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ flask run
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (flask:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
2020-09-10 14:00:32 +0000 UTC
Hi, I am having some issues running the code and will need some help.
2020-09-10 13:44:08 +0000 UTC
Hi Ioana - Please share which episodes of the Keras course and which area of code you're currently in when you get this error. When you refer to predict.py, are you referring to the predict_app.py file used in the Flask deployment episodes, or something else?
2020-09-07 07:15:06 +0000 UTC
Hi, I have downloaded the whole repo and installed requirements, also followed your tutorials, but when I run predict.py, i get into this error : File "C:\Users\name\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\saved_model\loader_impl.py", line 110, in parse_saved_model
raise IOError("SavedModel file does not exist at: %s/{%s|%s}" %
OSError: SavedModel file does not exist at:
/models/my_model_weights.h5/{saved_model.pbtxt|saved_model.pb} Can you please help? the model is located at the correct folder.
2020-09-06 16:36:50 +0000 UTC
Hi Sarah, which code is this for? The Flask application to predict on cat and dog images? If so, after you upload the image, click predict, right click the web page > Inspect > Console > Is there any message or error here? Also, check the terminal where Flask is running and report if any error is there as well.
2020-07-20 05:12:27 +0000 UTC
Hello, can you help me ? when I launch the application, download the template and upload the image, nothing happens in the pages
2020-07-20 00:51:33 +0000 UTC
Hi Zhuohong - Are you referring to the small cat and dog data set that contained only 40 training images, 32 validation images, and 10 test images? If so, you can find that data set in either the 1.0.0 or 1.0.1 version attachments of this post. Within the downloaded zip, the images will be located under \data\cats-and-dogs. Let me know if you're referring to something else.
2020-07-11 05:39:45 +0000 UTC
Hi, I was not able to find the same amount of the corresponding images in the zip files downloaded and the link to the post of all images expired as well. Is there a way that you can post the images again? Thank you!
2020-07-11 02:18:18 +0000 UTC
Hey Matilda - Check out the potential solution linked below in the comment by user amitdingareNovelis. It appears this may be a compatibility issue with TensorFlow 2. Let me know if this works for you.
https://github.com/keras-team/keras/issues/12379#issuecomment-471339468
2020-02-08 03:54:01 +0000 UTC
I tried to run this notebook and got this error message:
AttributeError: module 'tensorflow.python.keras.backend' has no attribute 'get_graph'
Has it anything to do with what version I have of tf or keras? I have tried google but not with any success.
2020-02-07 11:40:24 +0000 UTC
Hey Rafael - I'm not sure why the dtype is not showing on your test_labels, but I wouldn't worry too much about this, as we don't make use of this attribute anyway. For your predictions, you can see that your model is predicting very closely to 0s and 1s, but not 100% completely. The second array, for example, showing as [9.9997699e-01, 2.3023344e-05] can be interpreted as your model assigning a 99.997699% probability that the second sample is a 0.
If you want to see the predictions as 0s and 1s though, you can print predictions.argmax(axis=1)
Hello. I'm trying to use this code for my own images, but iwhen I print the test labels I get the following: [1. 0. 1. 0. 1. 1. 0.]. No dtype appears. Also, in the predictions instead of 0's and 1's I get the folwing:
2019-05-23 20:09:17 +0000 UTC
Hi Riser, the link you provided is not working.
2019-05-02 04:56:25 +0000 UTC
Hi i'm wondering why the outcome is so bad. Here is my link of jupyter notebook screen and outcome saving folder(<a href="https://imgur.com/a/TNedSRU)" rel="nofollow noopener" target="_blank">https://imgur.com/a/TNedSRU)</a> i ran it 3 times but only 4 image files were good and others are just white color image files
2019-05-02 03:30:51 +0000 UTC
Hey Ramin - In the video that follows the CNN video you referenced, we do something similar to what I believe you're looking for using Keras code. Check it out and let me know! Most videos in this series have corresponding blogs too:
<a href="http://deeplizard.com/learn/video/cNBBNAxC8l4" rel="nofollow noopener" target="_blank">http://deeplizard.com/learn/video/cNBBNAxC8l4</a>
2018-12-11 00:45:02 +0000 UTC
Hello again. A simple question. I was watching the video "Convolutional Neural Networks (CNNs) explained" from Machine Learning & Deep Learning Fundamentals series. In that video, there are several graphs of recognized patterns from filters in hidden layers (for example patterns of faces of dogs from layer #4). Is it possible from the code that you provided in the these series (e.g. the Keras code), to visualize such patterns generated by the hidden layers? If, yes, can you please send a link and/or info that I work through it by myself or a code that you used in that video? Thanks a lot in advance.
2018-12-10 21:37:42 +0000 UTC
Hey Ramin - Keras ImageDataGenerator() will only work with 2D images. Since DICOM images are 3D, this will cause an issue. According to the link below, the creator of Keras suggests creating a custom data generator to handle 3D images.
<a href="https://github.com/keras-team/keras/issues/2939" rel="nofollow noopener" target="_blank">https://github.com/keras-team/keras/issues/2939</a>
Also, the following link may be helpful as well.
<a href="https://github.com/keras-team/keras/issues/10150" rel="nofollow noopener" target="_blank">https://github.com/keras-team/keras/issues/10150</a>
A user there gives a link to a blog that shows an example of creating a custom generator to handle 3D input.
2018-12-03 18:28:56 +0000 UTC
Hello, I have a series of images in DICOM format. What is the best way to use these files directly, without converting to jpeg format, in Keras? In case, if Keras and tf cannot handle DICOM format, what would be the best way to convert a large number of DICOMs on-the-fly?
2018-12-03 12:37:04 +0000 UTC
Hey Eddie,
I was able to reproduce the first issue with the deprecation warning. To prevent this warning, you would just need to instead use the function that the deprecation warning mentions. Specifically, you would need to substitute
(ndimage.imread(image_path),0)
with
(plt.imread(image_path),0)
I was not able to reproduce the second issue. It appears your image is not the correct shape. First, ensure that you’re running the code directly from the notebook available here with no changes (except for where you define your image_path). With or without the deprecation warning mentioned in the first issue, this code should still run.
If you’re still receiving the error after these steps, run the following and see what shapes are returned for each array. The first should be four dimensions (x, x, x, x), and the second should be three dimensions (x, x, x).
(aug_iter)[0].shape
(aug_images)[0].shape
2018-07-11 03:44:16 +0000 UTC
hello , I find some error when executing the code on jupyter notebook, can you help ? thanks
(1.)
image = np.expand_dims(ndimage.imread(image_path),0)
plt.imshow(image[0])
/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:2: DeprecationWarning: `imread` is deprecated!
`imread` is deprecated in SciPy 1.0.0.
Use ``matplotlib.pyplot.imread`` instead.
(2)# Augmented images
plots(aug_images, figsize=(20,7), rows=2)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-9-fea2bd13577e> in <module>()
1 # Augmented images
----> 2 plots(aug_images, figsize=(20,7), rows=2)
<ipython-input-3-592c0ea86a20> in plots(ims, figsize, rows, interp, titles)
12 if titles is not None:
13 sp.set_title(titles[i], fontsize=16)
---> 14 plt.imshow(ims[i], interpolation=None if interp else 'none')
/anaconda3/lib/python3.6/site-packages/matplotlib/pyplot.py in imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, hold, data, **kwargs)
3203 filternorm=filternorm, filterrad=filterrad,
3204 imlim=imlim, resample=resample, url=url, data=data,
-> 3205 **kwargs)
3206 finally:
3207 ax._hold = washold
/anaconda3/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, *args, **kwargs)
1853 "the Matplotlib list!)" % (label_namer, func.__name__),
1854 RuntimeWarning, stacklevel=2)
-> 1855 return func(ax, *args, **kwargs)
1856
1857 inner.__doc__ = _add_data_doc(inner.__doc__,
/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
5485 resample=resample, **kwargs)
5486
-> 5487 im.set_data(X)
5488 im.set_alpha(alpha)
5489 if im.get_clip_path() is None:
/anaconda3/lib/python3.6/site-packages/matplotlib/image.py in set_data(self, A)
651 if not (self._A.ndim == 2
652 or self._A.ndim == 3 and self._A.shape[-1] in [3, 4]):
--> 653 raise TypeError("Invalid dimensions for image data")
654
655 if self._A.ndim == 3:
TypeError: Invalid dimensions for image data
</ipython-input-3-592c0ea86a20></module></ipython-input-9-fea2bd13577e>
2018-07-10 14:58:34 +0000 UTC
Ah, ok cool. I went ahead and made a post with access to the exact images in the organized directory structure I used in the videos. It's at the link below if you end up wanting to use the same data set.
<a href="https://www.patreon.com/posts/19555349">https://www.patreon.com/posts/19555349</a>
2018-06-20 00:51:35 +0000 UTC
Never mind.. I overcame my laziness and found my images from the web. :)