Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
Note:
In the context of deep learning, a blob is also the entire image pre-processed and prepared for classification/training. Such pre-processing usually entails mean subtraction and scaling.
cv2.dnn.blobFromImage : a deep learning method from OpenCV that creates 4-dimensional blob from image. Optionally resizes and crops the image from the center, subtract mean values, scales values by scale factor, swap Blue and Red channels.
image : input image (with 1-, 3- or 4-channels).swapRB : flag which indicates that swap first and last channels in a 3-channel image is necessary.crop : flag which indicates whether the image will be cropped after resize or not.net.setInput(blob) : Sets the input value blob for the network net.
cv2.imread : Reads an image.
plt.imshow(image) : Displays data as an image.
Use cv2.imread to read the image we want to detect the objects in, into img at /cxldata/dlcourse/mask_rcnn_model_data/dining_table.jpg.
img = << your code comes here >>('/cxldata/dlcourse/mask_rcnn_model_data/dining_table.jpg')
Visualize the image img we have read using fixColor, the function we defined previously, and plt.imshow. Make sure to write this in a separate code-cell to be able to see the image img.
plt.imshow(fixColor(img))
Use cv2.dnn.blobFromImage to get the blob of the input image.
blob = << your code comes here >>(img, swapRB=True, crop=False)
Set blob as input to the network net using setInput.
net.<< your code comes here >>(blob)
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...