colab使用教程

cocolab使用教程

1 准备数据集

切换路径并用wget 下载coco和wikiart数据集,并用unzip解压数据集

%cd /content/drive/Shared\ drives/MySharedDrive/dataset
!pwd
!ls
!wget http://images.cocodataset.org/zips/train2017.zip
!wget http://web.fsktm.um.edu.my/~cschan/source/ICIP2017/wikiart.zip
!unzip train2017.zip
!unzip wikiart.zip

2 安装环境

根据python 版本以及cuda版本选择安装pytorch

查看python版本、cuda版本

!python --version
!nvcc --version
!nvidia-smi

根据版本安装

!pip install torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

测试pytorch是否可以调用gpu

import torch
print(torch.cuda.is_available())

3 切换到项目路径

切换到项目路径

!pwd
%cd /content/drive/Shared\ drives/MySharedDrive/code/MAST
!pwd
!ls

3.1 训练

nohup python -u train_autoencoder.py --output_path ../../results/train/vgg_decoder_with_connection/cascade_connection/r41/exp2-cascade-weight-1e-7 --perceptual_loss_weight 1e-7 --batch_size 8 --layer_list r41 --content_layers r41,r31,r21,r11 --cascade_weight 1e-7 --gpu 0 > ../../log/train_vgg_with_skip_cascade_connection_r41-exp2-cascade-weight-1e-7.log 2>&1 &

3.2 测试

!ls
%cd /content/drive/Shared\ drives/MySharedDrive/code/MAST/test
!python test.py --gpu 0 --is_batch --output_path ../results/batch_test/exp1
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值