- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
is there any way to obtain the FPS of image classifiers models in stream_inference.py ?
Thank you
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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)))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@macsz Thank you so much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @ramana.rachakonda it also worked for me ..

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page