From the course: Building Deep Learning Applications with Keras

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Image recognition with the ResNet50 model

Image recognition with the ResNet50 model

- [Instructor] So after going over the pre-trained models, we will do one example with ResNet. So I found these images online under input folder under the image laptop and woman. So we will use one of them, but you can insert your images here to play around with the code. So now let's open ResNet image recognition begin Python file. So we start by again importing our libraries and then we go ahead and initialize the ResNet50 model with the weights pre-trained on the ImageNet. This is what this line does. So next we load an image file, we resize it to 224 to 224 pixels, which is the size required by the ResNet model. This is what this line does. Next step, we will convert the image to a NumPy array, which is the format Keras requires. So we do that with the following line, x= image.img_to_array img Oh, let's fix the parenthesis and that's it. Then we add a batch dimension addition. So we need to add a new dimension to the array, simulating a batch size of one. This is again required by…

Contents