当前位置:网站首页>Convolutional neural network for machine learning uses cifar10 data set and alexnet network model to train classification model, install labelimg, and report error
Convolutional neural network for machine learning uses cifar10 data set and alexnet network model to train classification model, install labelimg, and report error
2022-06-28 16:13:00 【Hua Weiyun】
Use cifar10 Data set and alexnet Network model training classification model
download cifar10 Data sets

Code :
import torchvisionimport torchtransform = torchvision.transforms.Compose( [torchvision.transforms.ToTensor(), torchvision.transforms.Resize(224)])train_set = torchvision.datasets.CIFAR10(root='./',download=False,train=True,transform=transform)test_set = torchvision.datasets.CIFAR10(root='./',download=False,train=False,transform=transform)train_loader = torch.utils.data.DataLoader(train_set,batch_size=8,shuffle=True)test_loader = torch.utils.data.DataLoader(test_set,batch_size=8,shuffle=True)class Alexnet(torch.nn.Module): #1080 2080 def __init__(self,num_classes=10): super(Alexnet,self).__init__() net = torchvision.models.alexnet(pretrained=False) # The migration study net.classifier = torch.nn.Sequential() self.features = net self.classifier = torch.nn.Sequential( torch.nn.Dropout(0.3), torch.nn.Linear(256 * 6 * 6, 4096), torch.nn.ReLU(inplace=True), torch.nn.Dropout(0.3), torch.nn.Linear(4096, 4096), torch.nn.ReLU(inplace=True), torch.nn.Linear(4096, num_classes), ) def forward(self,x): x = self.features(x) x = x.view(x.size(0),-1) x = self.classifier(x) return xdevice = torch.device('cpu')net = Alexnet().to(device)loss_func = torch.nn.CrossEntropyLoss().to(device)optim = torch.optim.Adam(net.parameters(),lr=0.001)net.train()for epoch in range(10): for step,(x,y) in enumerate(train_loader): # 28*28*1 32*32*3 x,y = x.to(device),y.to(device) output = net(x) loss = loss_func(output,y) optim.zero_grad() loss.backward() optim.step() print("epoch:",epoch,'loss:',loss)install labelimg, And reporting errors
Target detection and labeling tool :labelimg
install pip install labelimg
Use labelimg

Report errors
ERROR: spyder 4.1.4 requires pyqtwebengine<5.13; python_version >= “3”, which is not installed. ERROR: spyder 4.1.4 has requirement pyqt5<5.13; python_version >= “3”, but you’ll have pyqt5 5.15.6 which is incompatible
Version mismatch problem
open Anaconda Prompt
Install with command Spyder
pip install spyder==4.1.4
perhaps
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ spyder==4.1.4

Use labelimg
Found in the installation environment labelimg.exe Copy to desktop 
open 
Open a picture

边栏推荐
- MySQL self connection query "suggestions collection"
- Visual Studio 2010 configuring and using qt5.6.3
- Redmibook Pro 14 enhanced version cannot open delta software drastudio_ v1.00.07.52
- Do not use short circuit logic to write STL sorter multi condition comparison
- See how the interface control devaxpress WinForms creates a virtual keyboard
- Change exchange (dynamic planning)
- Mysql自连接查询「建议收藏」
- 今天睡眠质量记录80分
- 3. caller service call - dapr
- wallys/DR7915-wifi6-MT7915-MT7975-2T2R-support-OpenWRT-802.11AX-supporting-MiniPCIe-Module
猜你喜欢

5 minutes to make a bouncing ball game

大神详解开源 BUFF 增益攻略丨直播讲座

【MySQL】官网文档学习之查询语句sql注意事项

leetcode:22. 括号生成

Coding Devops helps Sinochem information to build a new generation of research efficiency platform and drive the new future of "online Sinochem"

Qt5.5.1配置MSVC2010编绎器和windbg调试器

Lecturer solicitation order | Apache dolphin scheduler meetup sharing guests, looking forward to your topic and voice!

【Spock】处理 Non-ASCII characters in an identifier

一台服务器最大并发 tcp 连接数多少?65535?

讲师征集令 | Apache DolphinScheduler Meetup分享嘉宾,期待你的议题和声音!
随机推荐
REDIS00_ Explain redis Conf configuration file
今天睡眠质量记录80分
CODING DevOps 助力中化信息打造新一代研效平台,驱动“线上中化”新未来
GAIN的代码实现(4)——基于GAN的Spam数据集缺失数据填补(序)【改进版】
Change exchange (dynamic planning)
[high concurrency foundation] hidden dangers and solutions of MySQL concurrency under different transaction isolation levels
Redmibook Pro 14 enhanced version cannot open delta software drastudio_ v1.00.07.52
Gartner发布当前至2024年的五大隐私趋势
使用Karmada实现Helm应用的跨集群部署
Android和eclipse和MySQL上传图片并获取
The sadness of software testers is Their own technical ability can not meet the requirements of large manufacturers?
Qt create 5.0.3 配置Qt4.8.7
防火墙基础之流量管理与控制
运动App如何实现端侧后台保活,让运动记录更完整?
Visual studio 2019 software installation package and installation tutorial
Visual Studio 2010 配置和使用Qt5.6.3
【初学者必看】vlc实现的rtsp服务器及转储H264文件
PostgreSQL enables grouping statistics by year, month, day, week, hour, minute and second
逆向调试入门-PE结构详解02/07
[proteus simulation] L297 driving stepping motor