Count number of cars using Python step by step

 Count number of cars using Python step by step

#1 Installing requirements 

Then open cmd and type

#1 pip install Opencv-python

#2 pip install cvlib

#3 pip install matplotlib

#4 pip install TensorFlow

#5 pip install Keras

then Enter

#2 Making folder and files

First, make one and give a name to the folder then download any car image then paste it on the same folder

Make a folder and paste photos of cars

Create a file on the code editor

#3 Write code and run it

Open the py file and write code or paste

import cv2 import matplotlib.pyplot as plt import cvlib as cv from cvlib.object_detection import draw_bbox im = cv2.imread('car2.jpg') bbox, label, conf = cv.detect_common_objects(im) output_image = draw_bbox(im, bbox, label, conf) plt.imshow(output_image) plt.show() print('Number of cars in the image is '+ str(label.count('car')))




    

Let's Run the Code 


Car Image


Here you will see two results 
#1

First, you will see this

#2


After you will close that tab you will get number of cars in terminal


If you have any problem then contact me on telegram @odewithyash


0 Comments