当前位置:网站首页>ncnn 推理猫狗识别
ncnn 推理猫狗识别
2022-08-09 07:50:00 【HySmiley】
实现流程:
一、训练模型
准备数据集,编辑代码进行训练。下载内容在文章末尾。
import torch
import torch.nn as nn
import torchvision.models as models
from torchvision import datasets, transforms
from torch.autograd import Variable
import torch.optim as optim
import os
from trainlog import acc_lossHistory
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
class resnet18(nn.Module):
def __init__(self, num_classes=2):
super(resnet18, self).__init__()
net = models.resnet18(pretrained=True)
# net.classifier = nn.Sequential()
net.fc=nn.Sequential()
self.features = net
self.fc = nn.Sequential(
nn.Line
边栏推荐
猜你喜欢
随机推荐
Win10桌面图标排列混乱
Classes and Structures
CoCube传感器MPU6050笔记
LeetCode·每日一题·636.函数的独占时间·栈模拟
One-click login server script
链表专项练习(四)
在今天这个特殊的日子,我想要开始我的代码技术博客之路
A brief introduction to microservice architecture
Forest Program dfs+tanjar仙人掌
Important news丨.NET Core 3.1 will end support on December 13 this year
Lottie系列三 :原理分析
car-price-deeplearning-0411
SAP ALV 数据导出被截断的bug
【机器学习】降维代码练习
【机器学习】中国大学慕课《机器学习》课后习题(二)(回归)
原生JDBC操作数据库
信息反馈平台的设计与实现(一、项目设计)
C language: detailed explanation of soda bottle
Lottie系列一:介绍与使用
SAP ALV data export many of the bugs