摘要: 实现代码如下: import torch.functional as F class LeNet(torch.nn.Module): def __init__(self): super(LeNet, self).__init__() # 1 input image channel (black & 阅读全文
posted @ 2022-02-03 14:56 Geeksongs 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 保存模型: torch.save(model, 'model.pth') 加载模型: model = torch.load('model.pth') 阅读全文
posted @ 2022-02-03 11:45 Geeksongs 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 自定义数据集的代码如下: import os import pandas as pd from torchvision.io import read_image class CustomImageDataset(Dataset): def __init__(self, annotations_fil 阅读全文
posted @ 2022-02-03 11:40 Geeksongs 阅读(361) 评论(0) 推荐(0) 编辑

Coded by Geeksongs on Linux

All rights reserved, no one is allowed to pirate or use the document for other purposes.