[~] Refactor

This commit is contained in:
Siarhei Siniak 2021-07-20 09:55:35 +03:00
parent 70761d384d
commit caeccdf498

@ -845,27 +845,27 @@ def kernel_9_benchmark(
) )
def kernel_10(): def kernel_10():
import torch import torch
# Model # Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5m, yolov5x, custom model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5m, yolov5x, custom
# Images # Images
img = 'https://ultralytics.com/images/zidane.jpg' # or file, PIL, OpenCV, numpy, multiple img = 'https://ultralytics.com/images/zidane.jpg' # or file, PIL, OpenCV, numpy, multiple
# Inference # Inference
results = model(img) results = model(img)
# Results # Results
results.print() # or .show(), .save(), .crop(), .pandas(), etc. results.print() # or .show(), .save(), .crop(), .pandas(), etc.
return dict( return dict(
model=model, model=model,
) )
def kernel_11_benchmark( def kernel_11_benchmark(
o_7, o_7,
o_10, o_10,
): ):
import datetime import datetime
@ -874,7 +874,7 @@ def kernel_11_benchmark(
t2 = datetime.datetime.now() t2 = datetime.datetime.now()
for k in range(t5): for k in range(t5):
t6 = o_10['model'](img_ori) t6 = o_10['model'](img_ori)
t7 = t6.pandas().xywhn t7 = t6.pandas().xywhn
t3 = datetime.datetime.now() t3 = datetime.datetime.now()
t4 = (t3 - t2).total_seconds() / t5 t4 = (t3 - t2).total_seconds() / t5