djaym7 opened a new issue #19247:
URL: https://github.com/apache/incubator-mxnet/issues/19247
mxnet 1.7.0 latest cu101 and cu101mkl aws p3.2x instance.
**code pasted below to reproduce:**
from mxnet.gluon.model_zoo.vision import get_model
from gluoncv.data.transforms.presets.ssd import transform_test
import mxnet as mx
import numpy as np
import gluoncv
from mxnet.gluon.data.vision import transforms
import cv2
import time
from matplotlib.pyplot import imshow
import glob
categories = ['Person','non-Moving']
# model = self.load_model(best=True)
model = gluoncv.model_zoo.get_model('faster_rcnn_resnet50_v1b_voc')
#print(model)
model.load_parameters('/home/ec2-user/SageMaker/PICV/Segmentation
Job/OD/params/faster_rcnn_finalparams.params')
img = mx.random.randn(1,3,608,608,ctx = mx.gpu())
model.collect_params().reset_ctx(mx.gpu())
model.hybridize()
#img,image = transform_test(mx.nd.array(img),short=420, max_size=640)
#warmup
for i in range(10):
ids,scores,boxes = model(img)
ids,scores,boxes = ids.asnumpy(),scores.asnumpy(),boxes.asnumpy()
mx.nd.waitall()
%%time
#this is very low time
# start_time5 = time.time()
ids,scores,boxes = model(img)
ids,scores,boxes = ids.asnumpy(),scores.asnumpy(),boxes.asnumpy()
mx.nd.waitall()
# end_time5 = time.time()-start_time5
# print("detection time :{:0.2f}".format(end_time5))
%%timeit
ids,scores,boxes = model(img)
ids,scores,boxes = ids.asnumpy(),scores.asnumpy(),boxes.asnumpy()
mx.nd.waitall()
#cpu test
for i in range(10):
start_time5 = time.time()
ids,scores,boxes = model(img)
ids,scores,boxes = ids.asnumpy(),scores.asnumpy(),boxes.asnumpy()
mx.nd.waitall()
print(time.time()-start_time5)
model.collect_params().reset_ctx(mx.cpu())
img = img.as_in_context(mx.cpu())
#cpu test
for i in range(10):
start_time5 = time.time()
ids,scores,boxes = model(img)
ids,scores,boxes = ids.asnumpy(),scores.asnumpy(),boxes.asnumpy()
mx.nd.waitall()
print(time.time()-start_time5)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]