直接上代码,pytorch平台,测试darknet21,darknet53
本文代码能输出特征维度,cpu、gpu上执行时间
darknet21在嵌入式芯片上还达不到实时检测。
代码改自:
import time
import torch
import torch.nn as nn
import math
from collections import OrderedDict
# from nets.coordConv import CoordConv
class BasicBlock(nn.Module):
def __init__(self, inplanes, planes,dim):
super(BasicBlock, self).__init__()
self.conv1 = nn.Conv2d(inplanes, planes[0], kernel_size=1,stride=1, pa