Login using Social Account
     Continue with GoogleLogin using your credentials
We will read the image using an OpenCV method. We will resize it for making it easier to be viewed.
Then, we will make it into a blob which is a 4-dimensional array of images using cv2.dnn.blobFromImage
.
We also do the following steps
Read the image using cv2.imread()
:
img=<< your code comes here >>("/cxldata/projects/yolov4/soccer.jpg")
Resize the image using cv2.resize()
.
img=<< your code comes here >>(img, (608, 608))
Print the image size and get H,W
the height and width of the image:
print (img.shape)
(H, W) = img.shape[:2]
Show the image:
plt.imshow(fixColor(img))
Use the cv2.dnn.blobFromImage
to read the image as a blob, normalize it, fix the size of the image, and set the image channels as or OpenCV.
blob = cv2.dnn.blobFromImage(img, 1 / 255.0, (608, 608), swapRB=True, crop=False)
Print the blob shape:
print ("Shape of blob", blob.shape)
We can see the individual color streams of the image:
split_blob=np.hstack([ blob[0, 0, :, :],blob[0, 1, :, :], blob[0, 2, :, :],])
plt.imshow(fixColor(split_blob))
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...