import argparse
import time
import os
import json
from dataset import RSDataset
import sync_transforms
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from models.deeplabv3_version_1.deeplabv3 import DeepLabV3 as model1
from models.deeplabv3_version_2.deeplabv3 import DeepLabV3 as model2
from libs import average_meter, metric
from torch.autograd import Variable
import numpy as np
from tqdm import tqdm
from prettytable import PrettyTable
import torchvision
from torchvision import transforms
from palette import colorize_mask
from PIL import Image
from collections import OrderedDict
from tensorboardX import SummaryWriter
def parse_args():
parser = argparse.ArgumentParser(description="RemoteSensingSegmentation by PyTorch")
# dataset
parser.add_argument('--dataset-name', type=str, default='five')
parser.add_argument('--train-data-root', type=str, default='../data_5_6_21/train')
parser.add_argument('--val-data-root', type=str, default='../data_5_6_21/val')
parser.add_argument('--train-batch-size', type=int, default=32, metavar='N', help='batch size for training (default:16)')
parser.add_argument('--val-batch-size', type=int, default=32, metavar='N', help='batch size for testing (default:16)')
# output_save_path
parser.add_argument('--experiment-start-time', type=str, default=time.strftime('%m-%d-%H:%M:%S', time.localtime(time.time())))
parser.add_argument('--save-pseudo-data-path', type=str, default='/root/data/others/yaoganbisai/pseudo_data')
# augmentation
parser.add_argument('--base-size', type=int, default=512, help='base image size')
parser.add_argument('--crop-size', type=int, default=512, help='crop image size')
parser.add_argument('--flip-ratio', type=float, default=0.5)
parser.add_argument('--resize-scale-range', type=str, default='0.5, 2.0')
# model
parser.add_argument('--model', type=str, default='deeplabv3_version_1', help='model name')
parser.add_argument('--backbone', type=str, default='resnet50', help='backbone name')
parser.add_argument('--pretrained', action='store_true', default=True)
parser.add_argument('--n-blocks', type=str, default='3, 4, 23, 3', help='')
parser.add_argument('--output-stride', type=int, default=16, help='')
parser.add_argument('--multi-grids', type=str, default='1, 1, 1', help='')
parser.add_argument('--deeplabv3-atrous-rates', type=str, default='6, 12, 18', help='')
parser.add_argument('--deeplabv3-no-global-pooling', action='store_true', default=False)
parser.add_argument('--deeplabv3-use-deformable-conv', action='store_true', default=False)
parser.add_argument('--no-syncbn', action='store_true', default=False, help='using Synchronized Cross-GPU BatchNorm')
# criterion
parser.add_argument('--class-loss-weight', type=list, default=
# [0.007814952234152803, 0.055862295151291756, 0.029094606950899726, 0.03104357983254851, 0.22757710412943985, 0.19666243636646102, 0.6088052968747066, 0.15683966777104494, 0.5288489922602664, 0.21668940382940433, 0.04310240828376457, 0.18284053575941367, 0.571096349549462, 0.32601488184885147, 0.45384359272537766, 1.0])
# [0.007956167959807792, 0.05664417300631733, 0.029857031694750392, 0.03198534634969046, 0.2309102255169529,
# 0.19627322641039702, 0.6074939752850792, 0.16196525436190998, 0.5396602408824741, 0.22346488456565283,
# 0.04453628275090391, 0.18672995330033487, 0.5990724459491834, 0.33183887346397484, 0.47737597643193597, 1.0]
[0.008728536232175135, 0.05870821984204281, 0.030766985878693004, 0.03295408432939304, 0.2399409412190348, 0.20305583055639448, 0.6344888568739531, 0.16440413437125656, 0.5372260524694122, 0.22310945250778813, 0.04659596810284655, 0.19246378709444723, 0.6087430986295436, 0.34431415558778183, 0.4718853977371564, 1.0])
# loss
parser.add_argument('--loss-names', type=str, default='cross_entropy')
parser.add_argument('--classes-weight', type=str, default=None)
parser.add_argument('--momentum', type=float, default=0.9, metavar='M', help='momentum (default:0.9)')
parser.add_argument('--weight-decay', type=float, default=0.0001, metavar='M', help='weight-decay (default:1e-4)')
# optimizer
parser.add_argument('--optimizer-name', type=str, default='Adadelta')
# learning_rate
parser.add_argument('--base-lr', type=float, default=0.1, metavar='M', help='')
# environment
parser.add_argument('--use-cuda', action='store_true', default=True, help='using CUDA training')
parser.add_argument('--num-GPUs', type=int, default=2, help='numbers of GPUs')
parser.add_argument('--num_workers', type=int, default=4)
# validation
parser.add_argument('--eval', action='store_true', default=False, help='evaluation only')
parser.add_argument('--no-val', action='store_true', default=False)
parser.add_argument('--best-kappa', type=float, default=0)
parser.add_argument('--total-epochs', type=int, default=12, metavar='N', help='number of epochs to train (default: 120)')
parser.add_argument('--start-epoch', type=int, default=0, metavar='N', help='start epoch (default:0)')
parser.add_argument('--resume-path', type=str, default=None)
args = parser.parse_args()
directory = "work_dirs/%s/%s/%s/%s/" % (args.dataset_name, args.model, args.backbone, args.experiment_start_time)
args.directory = directory
if not os.path.exists(directory):
os.makedirs(directory)
config_file = os.path.join(directory, 'config.json')
with open(config_file, 'w') as file:
json.dump(vars(args), file, indent=4)
if args.use_cuda:
print('Numbers of GPUs:', args.num_GPUs)
else:
print("Using CPU")
return args
class DeNormalize(object):
def __init__(self, mean, std):
self.mean = mean
self.std = std
def __call__(self, tensor):
for t, m, s in zip(tensor, self.mean, self.std):
t.mul_(s).add_(m)
return tensor
class Trainer(object):
def __init__(self, args):
self.args = args
resize_scale_range = [float(scale) for scale in args.resize_scale_range.split(',')]
sync_transform = sync_transforms.Compose([
sync_transforms.RandomScale(args.base_size, args.crop_size, resize_scale_range),
sync_transforms.RandomFlip(args.flip_ratio)
])
self.resore_transform = transforms.Compose([
DeNormalize([.485, .456, .406], [.229, .224, .225]),
transforms.ToPILImage()
])
self.visualize = transforms.Compose([transforms.ToTensor()])
class_name = args.dataset_name
if class_name == 'fifteen': from class_names import fifteen_classes
if class_name == 'five': from class_names import five_classes
self.train_dataset = RSDataset(class_name, root=args.train_data_root, mode='train', sync_transforms=sync_transform)
self.train_loader = DataLoader(dataset=self.train_dataset,
batch_size=args.train_batch_size,
num_workers=args.num_workers,
shuffle=True,
drop_last=True)
print('class names {}.'.format(self.train_dataset.class_names))
print('Number samples {}.'.format(len(self.train_dataset)))
if not args.no_val:
val_data_set = RSDataset(class_name, root=args.val_data_root, mode='val', sync_transforms=None)
self.val_loader = DataLoader(dataset=val_data_set,
batch_size=args.val_batch_size,
num_workers=args.num_workers,
shuffle=False,
drop_last=True)
self.num_classes = len(self.train_dataset.class_names)
print("类别数:", self.num_classes)
self.class_loss_weight = torch.Te
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于PyTorch实现高分遥感地物分类语义分割项目python源码+文档说明+高分辨率遥感数据集.zip 个人大四的毕业设计、经导师指导并认可通过的高分设计项目,评审分96.5分。主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的学习者,也可作为课程设计、期末大作业。 【资源说明】 不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的毕设或者课设、作业,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96.5分,放心下载使用! 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。
资源推荐
资源详情
资源评论
收起资源包目录
本科毕业设计-基于PyTorch实现高分遥感地物分类语义分割项目源码+文档说明+高分辨率遥感数据集.zip (858个子文件)
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2.csv 61KB
classes_sample.jpg 234KB
文档说明.md 2KB
predict.png 79.44MB
blend.png 79.32MB
img_gt_pre.png 1.39MB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_380.png 652KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_381.png 652KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_142.png 651KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_382.png 651KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_439.png 650KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_353.png 650KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_352.png 649KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_410.png 648KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_411.png 647KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_354.png 645KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_383.png 644KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_408.png 642KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_409.png 642KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_407.png 640KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_438.png 639KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_465.png 636KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_437.png 635KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_434.png 634KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_355.png 634KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_435.png 633KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_351.png 632KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_436.png 631KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_406.png 629KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_141.png 628KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_373.png 626KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_379.png 620KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_374.png 618KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_113.png 615KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_48.png 614KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_466.png 613KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_46.png 612KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_467.png 611KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_464.png 610KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_493.png 610KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_327.png 609KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_114.png 609KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_242.png 608KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_593.png 607KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_170.png 607KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_323.png 606KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_143.png 606KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_468.png 604KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_401.png 602KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_74.png 602KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_324.png 601KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_743.png 601KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_322.png 601KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_207.png 599KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_471.png 599KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_325.png 599KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_326.png 599KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_350.png 599KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_665.png 599KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_302.png 597KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_664.png 596KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_179.png 596KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_49.png 595KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_378.png 595KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_585.png 595KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_76.png 593KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_746.png 593KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_310.png 592KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_549.png 592KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_346.png 592KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_270.png 592KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_621.png 591KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_552.png 591KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_490.png 591KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_309.png 590KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_656.png 590KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_443.png 590KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_594.png 589KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_636.png 589KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_657.png 589KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_634.png 589KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_275.png 589KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_173.png 588KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_463.png 588KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_521.png 588KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_426.png 588KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_386.png 587KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_456.png 587KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_283.png 586KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_455.png 586KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_67.png 585KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_261.png 585KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_548.png 585KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_33.png 585KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_472.png 584KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_517.png 584KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_551.png 584KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_95.png 583KB
vis.png 583KB
GF2_PMS2_E116.0_N39.1_20170302_L1A0002214760-MSS2_440.png 583KB
共 858 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
coderᅟᅠ
- 粉丝: 3991
- 资源: 1126
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 纯电动汽车(含增程式)的 Simulink 整车仿真模型
- Matlab魔术轮胎公式,轮胎动力学仿真,包含纯制动,纯转弯,以及制动+转弯联合3种工况 附带参考文献,复现lunwen代码仿
- comsol锂枝晶模型 四合一 1雪花枝晶 2单点形核 3多点形核 4形状形核 包含相场、浓度场和电场三种物理场(雪花枝晶除外)
- 三相电压型PWM整流器,电压外环采用非线性二阶离散自抗扰(ADRC用的模块搭建的离散型),电流内环PI控制 ADRC扰动跟踪良
- 高压直流输电Matlab仿真模型(LCC- HVDC)500kv和800kv的电压等级都有,而且有控制切
- LabVIEW调用VisionPro框架代码 VisionPro labview 2020
- 弯扭耦合行星齿轮动力学程序matlab
- 六自由度并联Stewart Platform平台, matlab GUI界面,有动画显示,可更改角度和杆长 六自由度平台(六自
- 风储调频模型 matlab simulink 风储联合调频,风电储能参与系统一次调频 风机内部结构详细,仿真速度快,同样适用于
- 基于优化算法的光伏发电系统仿真 在本项目中,设计了基于光伏系统(包括光伏,电池,转器,PI控制器,逆变器和充电控制)架构的Sim
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功