hjimce / compress_yolo Goto Github PK
View Code? Open in Web Editor NEW对yolo模型进行网络压缩、修剪等实验
License: Other
对yolo模型进行网络压缩、修剪等实验
License: Other
Do you need to change the setting in CFG file to prune the model? Setting "prune=1" in makefile only is not helping the model reduction. What else changes do I have to make? Thanks.
在运行您的代码时,我发现在GPU下运行不会进入prune_convolutional_layer这个函数。在GPU下运行,更新网络参数是运行update_network_gpu这个函数,而不是update_network这个函数。请问一下可以在GPU上运行吗,还是说需要在network_kernels.cu文件里添加相应的函数?
效果挺好,不过我上传的这份代码,没有提供霍夫曼编码部分代码,只提供了修剪部分的代码,可以把修剪训练好的模型,用压缩软件压缩一下,测试一下压缩比,一般可以压缩70%以上
你好,感谢您的分享,我可以很顺利的训练原版的darknet,但是我在使用你的库的时候遇到了几个问题:
./darknet detector train cfg/voc.data cfg/yolov3-spp.cfg yolov3-spp_110000.weights
遇到以下报错:
88 conv 24 1 x 1 / 1 21 x 21 x1024 -> 21 x 21 x 24
89 Type not recognized: [yolo]
Unused field: 'mask = 6,7,8'
Unused field: 'anchors = 10,13,16,30,33,23,30,61,62,45,59,119,116,90,156,198,373,326'
Unused field: 'classes = 3'
Unused field: 'num = 9'
Unused field: 'jitter = .3'
Unused field: 'ignore_thresh = .7'
Unused field: 'truth_thresh = 1'
Unused field: 'random = 1'
90 route 86
91 conv 256 1 x 1 / 1 21 x 21 x 512 -> 21 x 21 x 256
92 Type not recognized: [upsample]
Unused field: 'stride = 2'
93 route 92 61
94 Layer before convolutional layer must output image.: Cannot allocate memory
darknet: ./src/utils.c:224: error: Assertion `0' failed.
Aborted (core dumped)
因此我猜测,您没有实现upsample yolo等层,对吗?
所以想问问您具体修改的情况,非常感谢(ps: 如果能出教程就更好了:happy)
您好,我对您在yolo上进行剪枝的工作非常感兴趣。我下载了您的源码进行测试,但是好像没有cfg文件夹。我直接用yolo作者github的cfg,但是并没有tiny-yolo.cfg这个文件,请问您是对yolov1-tiny.cfg进行的剪枝吗?是否是直接把作者的cfg文件夹拷贝过去就可以运行了呢?
@hjimce @Jimce Hi thanks for the code base i tried your source code base for the tiny yolo and the mode size remained the same can you please let me knwif you have implmented the huffman coding into ur code base
2. How did ur model size decerease from 64M to 18M
3. What is the fps you have achieved by pruning the model was there any drop in the accuracy of the model and the mAP values
Is it only the convolution part that is pruned at layer update? Why set different threhold value in cpu function(0.01) and gpu function(0.001)?
Hi, Can i know how long is the pruning process gonna be? Also, how is the compression vs mAP effect?
(base) wupeng@ubuntu:/data_ssd/yolo/Vehicle/tiny-yolo$ /data_ssd/compress_yolo/darknet detector train voc.data yolov3-tiny.cfg backup/yolov3-tiny_130000.weights -gpus 0
0
yolov3-tiny
layer filters size input output
0 conv 16 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 16
1 max 2 x 2 / 2 416 x 416 x 16 -> 208 x 208 x 16
2 conv 32 3 x 3 / 1 208 x 208 x 16 -> 208 x 208 x 32
3 max 2 x 2 / 2 208 x 208 x 32 -> 104 x 104 x 32
4 conv 64 3 x 3 / 1 104 x 104 x 32 -> 104 x 104 x 64
5 max 2 x 2 / 2 104 x 104 x 64 -> 52 x 52 x 64
6 conv 128 3 x 3 / 1 52 x 52 x 64 -> 52 x 52 x 128
7 max 2 x 2 / 2 52 x 52 x 128 -> 26 x 26 x 128
8 conv 256 3 x 3 / 1 26 x 26 x 128 -> 26 x 26 x 256
9 max 2 x 2 / 2 26 x 26 x 256 -> 13 x 13 x 256
10 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512
11 max 2 x 2 / 1 13 x 13 x 512 -> 13 x 13 x 512
12 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024
13 conv 256 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 256
14 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512
15 conv 18 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 18
16 Type not recognized: [yolo]
Unused field: 'mask = 3,4,5'
Unused field: 'anchors = 10,14,23,27,37,58,81,82,135,169,344,319'
Unused field: 'classes = 1'
Unused field: 'num = 6'
Unused field: 'jitter = .3'
Unused field: 'ignore_thresh = .7'
Unused field: 'truth_thresh = 1'
Unused field: 'random = 1'
17 route 13
18 conv 128 1 x 1 / 1 13 x 13 x 256 -> 13 x 13 x 128
19 Type not recognized: [upsample]
Unused field: 'stride = 2'
20 route 19 8
21 Layer before convolutional layer must output image.: File exists
darknet: ./src/utils.c:224: error: Assertion `0' failed.
Aborted (core dumped)
自己训练的一个模型,想压缩一下,但是输入命令出错,不知道哪儿的问题
./src/convolutional_layer.c: In function ‘cudnn_convolutional_setup’:
./src/convolutional_layer.c:134:5: error: too few arguments to function ‘cudnnSetConvolution2dDescriptor’
cudnnSetConvolution2dDescriptor(l->convDesc, l->pad, l->pad, l->stride, l->stride, 1, 1, CUDNN_CROSS_CORRELATION);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
Makefile:84: recipe for target 'obj/convolutional_layer.o' failed
make: *** [obj/convolutional_layer.o] Error 1
请问怎么解决呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.