Mobilenet-YOLO-Pytorch
Mobilenet-YOLO-Pytorch copied to clipboard
problem about the Image processing time(600ms)
Dear Eric Liu, I have tested the processing time on your code. using "model_best.pth.tar" you listed on your "readme", one image(the image you offered on "images") processing time is 600ms , it is too long compare to Yolo-Fastest(20ms)[https://github.com/dog-qiuqiu/Yolo-Fastest]. I wonder if it is a normal time result, if not, May I ask you what error I make?
`def inference_image(model, original_image,device): # Transforms transform_test = transforms.Compose([ transforms.Resize(size=(416,416), interpolation=2), transforms.ToTensor(), transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)), ]) # Transform image = transform_test(original_image)
# Move to default device
image = image.to(device)
start_3 = datetime.utcnow()
print("model函数之前前", start_3)
detections = model(image.unsqueeze(0)) # (N, num_defaultBoxes, 4), (N, num_defaultBoxes, n_classes)
end_3 = datetime.utcnow()
print("model函数之后后", end_3)
c3 = (end_3 - start_3)
print("model经过多少秒", c3)
print("model经过多少秒(不含毫秒)", c3.seconds)
print("model经过多少毫秒c.microseconds", c3.microseconds)
`
This is my code for estimating time
def inference_image(model, original_image,device):
# Transforms
transform_test = transforms.Compose([
transforms.Resize(size=(352,352), interpolation=2),
transforms.ToTensor(),
transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),
])
# Transform
image = transform_test(original_image)
image = image.to(device)
# Move to default device
start_3 = datetime.now().timestamp()
print("model函数之前前", start_3)
detections = model(image.unsqueeze(0)) # (N, num_defaultBoxes, 4), (N, num_defaultBoxes, n_classes)
end_3 =datetime.now().timestamp()
print("model函数之后后", end_3)
c3 = (end_3 - start_3)
print("model经过多少秒", c3)
print("model经过多少毫秒", c3*1000)
return detections
in line , the result was
model函数之前前 1625622913.572254
model函数之后后 1625622913.588143
model经过多少秒 0.01588916778564453
model经过多少毫秒 15.889167785644531
And also , I updated the inference resolution ,
transforms.Resize(size=(352,352), interpolation=2),
Dear Eric Liu,
I use your code, but my result is still >=600ms, this is my computer configuration,could you please tell me why?thank you。
My device was GTX1080 Ti , your result was too strange . Did your gpu device was enabled ?