Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6574 Discussions

Calculate the frame per second of GoogleNet classifier

idata
Employee
1,167 Views

is there any way to obtain the FPS of image classifiers models in stream_inference.py ?

 

Thank you

0 Kudos
4 Replies
idata
Employee
822 Views

@ibrahimsoliman python example:

 

from timeit import default_timer as timer time_start = timer() CODE time_end = timer() print('FPS: %.2f fps' % (1000/(time_end-time_start)))

0 Kudos
idata
Employee
822 Views

@macsz Thank you so much

0 Kudos
idata
Employee
822 Views

Another way to do the same

 

from timeit import timeit def runparallel(count=100, num=[]): numdevices = num if len(num) == 0: numdevices = range(len(devices)) for i in range(count): # ***************************************************************** # Load the Tensor to each of the devices # ***************************************************************** for devnum in numdevices: img = choice(imgarr) graphHandle[devnum].LoadTensor(img, 'user object') # ***************************************************************** # Read the result from each of the devices # ***************************************************************** for devnum in numdevices: tensor, userobj = graphHandle[devnum].GetResult() def runthreaded(count=100,num=[]): numdevices = num if len(num) == 0: numdevices = range(len(devices)) thread_list = [] for ii in numdevices: thread_list.append(Thread(target=runparallel, args=(count,[ii],))) for thread in thread_list: thread.start() for thread in thread_list: thread.join() if __name__ == '__main__': # ***************************************************************** # Runs and times runthreaded with 'i' sticks, until all sticks # run at once # ***************************************************************** for i in range(1, len(devices)+1): num = str(list(range(i))) tot_time = timeit("runthreaded(count=100,num="+num+")", setup="from __main__ import runthreaded", number=1) print("\n\nRunning " + argv[1] +" on "+str(i)+" sticks threaded : %0.2f FPS\n\n"%(100.0*i/tot_time))
0 Kudos
idata
Employee
822 Views

Thanks @ramana.rachakonda it also worked for me ..

0 Kudos
Reply