Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

陆建鹏-CV-OpenCV-20220406.md #9

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

llllji
Copy link

@llllji llllji commented Apr 7, 2022

Colab 教程

登录Google Drive以创建保存colab笔记

进入 Google Drive ;使用账号(google账号)进行登录(翻墙) https://drive.google.com/

创建文件夹及创建新的 Colab 笔记

进入Google Drive后点击新建,创建文件夹

在新建文件夹app下进行colab笔记创建;

更多中存在colab;点击colab

更多当中不存在colab;需点击关联更多应用,搜索colab进行下载安装


直接打开Colaboratory创建colab笔记

从chrome浏览器进入Colaboratory,点击左上角文件,上传和新建笔记

打开笔记后,先点击左下角按钮,后点击左上角按钮,装载 Google 云端硬盘

接下来会出现如下代码,点击运行即可,即登录Google Drive,把笔记保存在云端

出现drive表明已将文件保存

在进行工作时需要先进入对应的目录下面

import os
os.chdir('/content/drive/MyDrive/')
进入项目文件夹的方法

colab的使用

colab的界面类似jupyter notebook,可以点击+代码来创建代码块,+文本创建md文本块 ,也可以点击下方的<>(代码段)使用第三方库,选择相应的库,点击插入即可


colab也可以进行分享和将代码保存在github上

安装GPU版本的TensorFlow及Pytorch

进入代码执行程序->更改运行时类型->在硬件加速器中选择GPU


安装TensorFlow

!pip install tensorflow 

检查安装

import tensorflow as tf    
print(tf.__version__)

检查tf版本

tf.config.list_physical_devices('GPU') 

检查是否有GPU

from tensorflow.python.client import device_lib
local_device_protos = device_lib.list_local_devices()
print(local_device_protos) 

查看GPU的信息

安装Pytorch

!pip install torch

安装

import torch
torch.cuda.is_available() 

检查是否安装成功

torch.cuda.device_count()
torch.cuda.get_device_name(0)

查看GPU数量

torch.cuda.get_device_capability() 

查看GPU容量

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant