我想获得预先构建的caffe模型的第6层的输出并在其上训练SVM.我的目的是构建一个自定义图像分类器,用户可以在其中创建自定义图像类,并在这些类之间对输入图像进行分类,而不是imagenet类.这里是伪代码:
#input
file='cat.jpg'
image=caffe.io.load_image(file)
#model
net = caffe.Classifier('deploy.prototxt','model.caffemodel')
#compute activation at layer 6 --- Need help here. Will net.forward help? will the activation be retained?
#extract features from layer 6:
features = net.blobs['fc6'].data[4][:,0, 0]
#SVM
category=svm.predict(features)
print get_category_name(category)
Run Code Online (Sandbox Code Playgroud) python computer-vision neural-network caffe conv-neural-network
我在使用caffe从图像生成HDF5数据文件时遇到了这个问题.
所述caffe.io.load_image载荷图像转换成在归一化范围0-1 varible.
调整大小,但所有值都img转换为零
img = caffe.io.load_image( patht_to_file )
print img.shape
print img.dtype
img = caffe.io.resize( img, (3,SIZE, SIZE) ) #resizes but all values in img converted to zero
print img.shape
print img.dtype
Run Code Online (Sandbox Code Playgroud)
我得到的输出是
(240, 320, 3)
float32
(3, 58, 58)
float64
Run Code Online (Sandbox Code Playgroud)
img对于某些值,将值更改为全0,任何人都可以帮我修复此问题.
我想同样的float32改变resize命令的顺序给出正确的输出
给var真正的非零值,img
但顺序和类型不是我需要的
img = caffe.io.resize( img, (SIZE, SIZE, 3) ) # Gives real non zero values to var img
print img.shape
print img.dtype
Run Code Online (Sandbox Code Playgroud)
产量
(240, 320, 3)
float32 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下脚本安装 Caffe 框架:https://gist.github.com/jetsonhacks/acf63b993b44e1fb9528并且出现 opencv2/core/core.hpp 错误。
CXX src/caffe/layers/data_layer.cpp
src/caffe/layers/data_layer.cpp:2:33:
fatal error: opencv2/core/core.hpp: No such file or directory
#include <opencv2/core/core.hpp>
^
compilation terminated.
make: *** [.build_release/src/caffe/layers/data_layer.o] Error 1
Run Code Online (Sandbox Code Playgroud)
在文档中,OpenCV 是可选的。但那个错误告诉我不是。这include和OpenCV安装无关吗?
我按照说明在mac上安装Caffe(仅限CPU),当我运行"make -j"时出错.
In file included from src/caffe/util/blocking_queue.cpp:5:
In file included from ./include/caffe/layers/base_data_layer.hpp:9:
In file included from ./include/caffe/layer.hpp:12:
In file included from ./include/caffe/util/math_functions.hpp:11:
./include/caffe/util/mkl_alternate.hpp:14:10: fatal error: 'cblas.h' file not found
#include <cblas.h>
^
1 error generated.
make: *** [.build_release/src/caffe/util/blocking_queue.o] Error 1
Run Code Online (Sandbox Code Playgroud)
我通过添加行修改了makefile.config:
USE_BLAS = apple
ADD_LDFLAGS = -I/usr/local/opt/openblas/lib
ADD_CFLAGS = -I/usr/local/opt/openblas/include
Run Code Online (Sandbox Code Playgroud)
但它没有解决问题.
任何帮助或建议将不胜感激!
我有一个关于更改网络输出层的问题(AlexNet/GoogleNet/ImageNet).因此标准输出是1x1000 Vector,因此每个类都有一个值.
我知道我可以将输出更改为例如5,所以如果我只有5个类,我会得到1x5 Vector.
但是如果我没有课程怎么办?是否可以将输出更改为18x18之类的矩阵.因为我的网应该输出密度图而不是"类".是否建议使用预先训练好的网络来完成我的任务,还是应该从头开始训练?
谢谢您的帮助 :-)
machine-learning computer-vision deep-learning caffe imagenet
我的道歉自我的问题以来听起来很愚蠢。但是我在深度学习和咖啡方面还很陌生。我们如何才能检测到需要多少次迭代才能在我们自己的数据集上微调预训练?例如,我为5个类的数据运行fcn32。何时可以通过查看训练阶段的损失和准确性来停止微调过程?
非常感谢
我使用以下命令将Solver()函数(第三个库中的函数)发出的输出结果写入文件中:caffe
if(std::freopen("redir.txt", "w", stdout)) {\n std::printf("stdout is redirected to a file\\n"); // this is written to redir.txt\n solver->Solve();\n std::fclose(stdout);\n}\nRun Code Online (Sandbox Code Playgroud)\n\n但由于该Solve()函数连续发出输出,但在执行redir.txt\xe2\x80\x8d 之前不会更新。std::fclose(stdout);所以我无法实时看到结果。
如何实时更新我的文件?
\n我想在函数中发送两个参数并接收两个值
我想修改这段代码,以便我能够发送两个参数并接收两个参数
list_value = [ 1, 2,0,-1,-9,2,3,5,4,6,7,8,9,0,1,50]
hnd = map(lambda (valua): function_f(valua), list_value)
Run Code Online (Sandbox Code Playgroud)
function_f是一个返回一个数字1或0的函数.
上面的代码可以在发送一个参数时完成工作,但我想发送两个而不是.所需函数的第一个参数是list_value,第二个参数是模型"net model train it using caffe"
所以我想编写一个函数,它可以完成前一个函数的相同工作,但返回两个参数,一个是[0或1],另一个是修改后的函数修改过的模型.
我想用Caffe框架和卷积神经网络实现对象检测,你能推荐一些论文和演示吗?
我只需要知道如何实现它.
如果您能提供源代码,那将是完美的.
computer-vision neural-network deep-learning caffe conv-neural-network