usage-of-caffe
来源:互联网 发布:sql 附加数据库 编辑:程序博客网 时间:2024/06/07 10:05
----------------------------train------fine-turn-----------------------------------------------------
1. training stage
!/usr/bin/env shcaff_root=xxxsolver_file=xxxcaffe_file=caffe_root+'built/tools/caffe'$caffe train -solver $solver_file -weights xxx.caffemodel -gpu 1,2 2>&1 | tee $log_file-snapshot xxx.solverstate
----------------------------plot-acc-loss--------------------------------------
caff_root/tools/extra/plot_ [0-7] xxx.png xx.log
------------------------plot-net-------------------------------------------------
./python/draw_net.py xxx.prototxt xxx.png xx
-------------------------------fine turn------------------------------
在套用模型的时候会将层名相同的参数值作为初始值赋值给相应层的参数,那么就要求层名相同的的层的定义要完全一致,假设输出不一致,那么赋值失败。如果在原模型中没有找到相应的层,那么该层的参数初始值与普通训练无异。
------------------0-----------------label-------------
#!/bin/bashIMAGE_ROOT=xxxrm -rf train.txtfind IMAGE_ROOT/image/ -name *xx.jpg | cut -d '/' -f3 |sed "s/$/ 1/" >> train.txtfine IMAGE_ROOT/image -name *yy.png | cut -d '/' -f3 | sed "s/$/ 2/" >> train.txtecho "done..."
--------------------1--------------------------lmdb----
#!/bin/bashrm -rf xxx_lmdbbuild/tools/convert_imageset --shuffle --resize_height=xxx --resize_width=xxx xx/images train_label.txt xxx_lmdbecho "done...."
label.txt 包含图片的名字 空格 类标
--------------------2-------------------------mean-----------------
build/tools/compute_image_mean xxx/train_lmdb xxx.binaryproto
----------------------------------------------------------------------------
//根据layer名字复制,layer的参数必须一样否则会报错...
//fineturn有些层发生儿变化 必须要改layer名字
I0329 09:13:13.990504 5366 net.cpp:261] This network produces output loss1/loss1I0329 09:13:13.990509 5366 net.cpp:261] This network produces output loss1/top-1I0329 09:13:13.990512 5366 net.cpp:261] This network produces output loss1/top-5I0329 09:13:13.990516 5366 net.cpp:261] This network produces output loss2/loss1I0329 09:13:13.990520 5366 net.cpp:261] This network produces output loss2/top-1I0329 09:13:13.990523 5366 net.cpp:261] This network produces output loss2/top-5I0329 09:13:13.990527 5366 net.cpp:261] This network produces output loss3/loss3I0329 09:13:13.990530 5366 net.cpp:261] This network produces output loss3/top-1I0329 09:13:13.990533 5366 net.cpp:261] This network produces output loss3/top-5I0329 09:13:13.990656 5366 net.cpp:274] Network initialization done.I0329 09:13:13.991480 5366 solver.cpp:60] Solver scaffolding done.I0329 09:13:13.995544 5366 caffe.cpp:129] Finetuning from ./sub_tianchi_models/finetuning_37w.caffemodel I0329 09:13:19.320947 5366 net.cpp:753] Ignoring source layer loss1/classifier I0329 09:13:19.325259 5366 net.cpp:753] Ignoring source layer loss2/classifier I0329 09:13:19.327749 5366 net.cpp:753] Ignoring source layer loss3/classifierI0329 09:13:25.825736 5366 net.cpp:753] Ignoring source layer loss1/classifierI0329 09:13:25.830339 5366 net.cpp:753] Ignoring source layer loss2/classifierI0329 09:13:25.833221 5366 net.cpp:753] Ignoring source layer loss3/classifier
-----------------------------feature--extractor----------------------------------
mean.binaryproto -> mean.npy
-- > https://github.com/BVLC/caffe/issues/290
---> http://www.zhihu.com/question/28102651/answer/39397649
def mean_npy():
mean_path = root_path + 'mean.binaryproto'
blob = caffe.proto.caffe_pb2.BlobProto()
data = open(mean_path,'rb').read()
blob.ParseFromString(data)
arr = np.array(caffe.io.blobproto_to_array(blob))
np.save( root_path +'mean.npy', arr[0])
mean_blob = blob_pb2.BlobProto()
data =open(os.path.join(LMDB_PATH,"mean.binaryproto"),'rb').read()
mean_blob.ParseFromString(data)
img_mean = np.array(mean_blob.data).reshape(mean_blob.num,mean_blob.channels,mean_blob.height,mean_blob.width)
---------------------------------------------------------------
num_epochs = num_iterations * batch_size / set_siz
Reference:
[1] http://www.cnblogs.com/denny402/category/759199.html
[2] http://chrischoy.github.io/research/reading-protobuf-db-in-python/
- usage-of-caffe
- caffe --Multi-GPU Usage
- Usage of Pseudocode
- Usage of MFC CRectTracker
- Usage of awk
- effective usage of strtok
- Usage of Protocol Buffer
- Usage of pmake
- Usage sample of SSL
- usage of >>>、>> and << operators
- Extensive usage of Make
- Usage of Oracle Block
- Usage of TKPROF
- Usage of Ftp
- Usage of Func delegate
- Usage of Vmstat
- Usage Of TRCA
- Usage of #pragma
- 第二周项目3-小试循环
- js 操作table
- 第2周项目3-小试循环
- Mac录制屏幕
- 简易登录系统源代码
- usage-of-caffe
- Linux计算cpu使用率
- 0020-接口与实现
- 第一次实验1-1
- 日志管理系统部署方法
- css背景样式
- python-opencv颜色提取分割
- 单片机的时钟分频
- 特征降维