1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/Linzai-Ultra-Light-Fast-Generic-Face-Detector-1MB

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
cal_flops.py 855
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
zhangjinlin Отправлено 10.10.2019 10:35 72957f4
"""
Output model complexity
"""
import time
import torch
from torchstat import stat
from torchsummary import summary
from vision.ssd.mb_tiny_fd import create_mb_tiny_fd
from vision.ssd.mb_tiny_RFB_fd import create_Mb_Tiny_RFB_fd
device = "cpu" # default cpu
width = 320
height = 240
# fd = create_mb_tiny_fd(2)
fd = create_Mb_Tiny_RFB_fd(2)
print(fd)
fd.eval()
fd.to(device)
x = torch.randn(1, 3, width, height).to(device)
summary(fd.to("cuda"), (3, width, height))
from ptflops import get_model_complexity_info
flops, params = get_model_complexity_info(fd.to(device), (3, width, height), print_per_layer_stat=True, as_strings=True)
print("FLOPS:", flops)
print("PARAMS:", params)
for i in range(5):
time_time = time.time()
features = fd(x)
print("inference time :{} s".format(time.time() - time_time))
stat(fd, (3, width, height))

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/Linzai-Ultra-Light-Fast-Generic-Face-Detector-1MB.git
git@api.gitlife.ru:oschina-mirror/Linzai-Ultra-Light-Fast-Generic-Face-Detector-1MB.git
oschina-mirror
Linzai-Ultra-Light-Fast-Generic-Face-Detector-1MB
Linzai-Ultra-Light-Fast-Generic-Face-Detector-1MB
master