当前位置:网站首页>Train yolov3 on colab (I)
Train yolov3 on colab (I)
2022-07-16 06:37:00 【Wang Kaixin】
use Colab The benefits of :
Computer building cuda The environment needs to have nvidia The graphics card ( I don't have ), But in colab There is no need to build an environment , And it's free , Very friendly .
step :
1、 Log in to Google hard disk :https://drive.google.com
2、 Right click in the blank space of Google hard disk , Choose more -> Connect more applications ;
3、 Enter in the search box cloaboratory, Find the software and install .
4、 Get into Colab, Back to Google hard drive section , Click the right mouse button in the blank area again , Choose more , At this time, we found that Colab Is already installed , Open the can .
5、 Open the interface as follows , And click the connection in the upper right corner to wait for the connection to succeed .
6、 Upper left corner modification , Open notebook settings , choice GPU.

7、 Click in the following order , In the pop-up window, select connect to Google Hard disk in the cloud , The file directory appears on the left drive.
appear drive
8、 Click on “+” Add code , Download the sample program , Point triangle operation .
!git clone https://github.com/AlexeyAB/darknet

9、 Configure it
%cd darknet
!sed -i 's/OPENCV=0/OPENCV=1/' Makefile
!sed -i 's/GPU=0/GPU=1/' Makefile
!sed -i 's/CUDNN=0/CUDNN=1/' Makefile

10、 compile ( It's a little slow , It takes about a minute )
!make

11、 download coco Data and pre training weight ( We need to make sure that the network is unblocked , Otherwise it will be very slow ).
!wget https://pjreddie.com/media/files/yolov3.weights

12、 Add display 、 Upload 、 Download file code .
# Show
def imShow(path):
import cv2
import matplotlib.pyplot as plt
%matplotlib inline
image = cv2.imread(path)
height, width = image.shape[:2]
resized_image = cv2.resize(image,(3*width, 3*height), interpolation = cv2.INTER_CUBIC)
fig = plt.gcf()
fig.set_size_inches(18, 10)
plt.axis("off")
plt.imshow(cv2.cvtColor(resized_image, cv2.COLOR_BGR2RGB))
plt.show()
# Upload files
def upload():
from google.colab import files
uploaded = files.upload()
for name, data in uploaded.items():
with open(name, 'wb') as f:
f.write(data)
print ('saved file', name)
# Download the file
def download(path):
from google.colab import files
files.download(path)

13、 All the work has been finished here . Check the environment, then use the official photos to test and show ( The training process is slow , Just wait patiently ).
%cd /content/darknet
!./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
imShow('predictions.jpg')

give the result as follows :
Up to now, it has been completed , If you want to train your pictures , You can go on and look down .
14、 Run the following code , Then upload your pictures to the disk where you have pictures
%cd ..
upload()

After uploading :
15、 Run the load code , Change the picture name to your own .
%cd darknet
!./darknet detect cfg/yolov3.cfg yolov3.weights ../3.jpg
imShow('predictions.jpg')

16、 The effect shows :
This is the original :
This is the output diagram :
complete .
边栏推荐
猜你喜欢

【PCB】关于电赛——硬件设计和PCB绘制的一些心得(持续更新)

STM32F103 guider - example game Tetris

蓝桥杯嵌入式-HAL库-LED_TEST

RTthread-线程的创建

MATLAB警告:名称不存在或不是目录
![[Multisim] problems that must be paid attention to when using ne5532p series operational amplifier simulation](/img/16/496c26d87407cc8e67182f209fe70b.png)
[Multisim] problems that must be paid attention to when using ne5532p series operational amplifier simulation

RTtread-动态内存分配

如何使用Keil5中的虚拟示波器进行软件仿真

第四章 STM32+LD3320+SYN6288+DHT11实现语音获取温湿度数值(下)

嵌入式软件开发 STM32F407 蜂鸣器 标准库版
随机推荐
IIC通讯
[matlab] matlab lesson 2 - preliminary drawing
#导入Word文档图片# 根文件系统制作与挂载
[Verilog] sub module connection related problems (adder and Its Optimization)
Keil5快捷键
第三章 LD3320语音识别模块的使用
C语言预处理指令大全
Dynamic memory allocation principle of C language and the use of heap (malloc, calloc, realloc, free)
C language macro definition (macro parameter creation string, pretreatment adhesive)
keil5软件报错 Error: L6406E: No space in execution regions with .ANY selector matching xxx
VScode设置语言为中文,并且解决中文注释乱码问题。
[stm32f1] drive DHT11 (cubemx configuration) (HAL Library)
【Multisim】使用NE5532P系列运放仿真时必须注意的问题
【Multisim】关于Multisim仿真“过零比较器”出现的问题以及解决方法
【 pcb】 quelques expériences sur la conception du matériel et le dessin des PCB dans le jeu électrique (mise à jour continue)
V4l2 operation process and interface description
Deep neural network -- implementation of LSTM composer
stm32学习(入门)
STM32F103 guider - example game Tetris
蓝桥杯嵌入式-HAL库-TIM_BASE