user's guidance
Mount Google Cloud Disk
from google.colab import drive
drive.mount('/content/drive')
install dependencies
!pip install torch==1.7.0 torchvision
!pip install opencv-python
Confirm connection to GPU
import tensorflow as tf
device_name = tf.test.gpu_device_name()
if device_name != '/device:GPU:0':
raise SystemError('没有发现GPU device')
print('Found GPU at: {}'.format(device_name))
# Found GPU at: /device:GPU:0
View graphics card model
!/opt/bin/nvidia-smi
switch working directory
import os
os.chdir("/content/drive/MyDrive/yolov5")
os.getcwd()
Prevent colab from dropping (put this code in the console)
function ClickConnect(){
console.log("Working");
document
.querySelector("#top-toolbar > colab-connect-button")
.shadowRoot
.querySelector("#connect")
.click()
}
var id=setInterval(ClickConnect,5*60000) //5分钟点一次,改变频率把5换成其他数即可,单位分钟
//要提前停止,请输入运行以下代码: clearInterval(id)
Finally, thank you for your study~