资源简介
对自己准备训练的数据集进行读取,即选取路径,读入数据其次将数据加载如train_loader中对图像进行训练等操作
代码片段和文件信息
# -*- coding: utf-8 -*-
“““
Created on Sat Oct 6 09:19:17 2018
@author: Administrator
“““
import torch
import torchvision
from torchvision import datasets transforms
import matplotlib.pyplot as plt
import numpy as np
import os
D=299
num=3000
change=300
# Data augmentation and normalization for training
# Just normalization for validation
data_transforms = {
‘train‘: transforms.Compose([
transforms.RandomSizedCrop(224)
transforms.RandomHorizontalFlip()
transforms.ToTensor()
transforms.Normalize([0.485 0.456 0.406] [0.229 0.224 0.225])
])
‘val‘: transforms.Compose([
transforms.Scale(256)
transforms.CenterCrop(224)
transforms.ToTensor()
transforms.Normalize([0.485 0.456 0.406] [0.229 0.224 0.225])
])
}
data_dir = ‘C:\\Users\\Administrator.SKY-20180518VHY\\Desktop\\rx‘
train_sets = datasets.ImageFolder(os.path.join(data_dir ‘train‘) data_transforms[‘train‘])
train_loader = torch.utils.data.DataLoader(train_sets batch_size=10 shuffle=True num_workers=4)
train_size = len(train_sets
- 上一篇:Python手写体数字识别带详细注释2.0
- 下一篇:动态规划代码
相关资源
- Python-DeepMoji模型的pyTorch实现
- Python for data analysis(第二版中文版代
- DataV.GeoAtlas全国GeoJSON省市区县json数据
- Data Science from Scratch First Principles wit
- Learning Data Mining With Python book 代码及数
- pytorch_pose_proposal_networks-master.zip
- Data Science Fundamentals for Python and Mongo
- 数据挖掘课程设计.rar
- Introduction to Data Science - A Python Approa
- Python-在特征金字塔网络FPN的Pytorch实现
- Python-PyTorch实时多人姿态估计项目的实
- Python-用PyTorch10实现FasterRCNN和MaskRCNN比
- Python-PyTorch对卷积CRF的参考实现
- Python-pytorch实现的人脸检测和人脸识别
- Python-pytorch中文手册
- Python-FastSCNN的PyTorch实现快速语义分割
- Python-深度增强学习算法的PyTorch实现策
- Python Data Analysis Cookbook by Ivan Idris
- Learning Data Mining with Python - Second Edit
- Python for Everybody: Exploring Data in Python
- Problem Solving in Data Structures and Algorit
- Fundamentals of Python Data Structures 无水印
- Data Structures and Algorithms in Python 无水印
- Data Science from Scratch First Principles wit
- Data Structures and Algorithms in Python文字版
- PyTorch 模型训练实用教程及原文
- problem-solving-with-algorithms-and-data-struc
- Problem Solving with Algorithms and DataStruct
- data-science-using-python-r
- Python for Data Analysis(2nd )中文带书签
评论
共有 条评论