import torch
import torch.nn as nn
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import torch.nn.functional as F
import torchvision
import time
import os
import shutil
from torchvision import datasets,transforms
from torch.utils.data import TensorDataset
from torch.utils.data import DataLoader
from sklearn.model_selection import train_test_split
from torch.optim import lr_scheduler
start=time.time()
base_dir = r'D:/pycharmworkspace/ISLR-master/fourweather'
train_dir = os.path.join(base_dir,'train')
test_dir = os.path.join(base_dir,'test')
tran_transformation = transforms.Compose([
transforms.Resize(224),
#随机把图片裁剪到192*192像素
transforms.RandomCrop(192),
#随机水平翻转 默认参数0.5
transforms.RandomHorizontalFlip(),
#图片随机旋转一定角度
transforms.RandomRotation(0.2),
#改变图片亮度、对比度、饱和度、色调
transforms.ColorJitter(brightness=0.5),
transforms.ColorJitter(contrast=0.5),
transforms.ToT
基于pytorch的自动下载RESNET预训练模型的四种天气分类
最新推荐文章于 2024-03-15 09:51:40 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)