我正在学习caffe(bvlc)。
当我分析代码时,我发现了一些我不认识的奇怪代码。
像这样 :
im2col_gpu_kernel<Dtype><<<CAFFE_GET_BLOCKS(num_kernels),
CAFFE_CUDA_NUM_THREADS>>>(
num_kernels, data_im, height, width, kernel_h, kernel_w, pad_h,
pad_w, stride_h, stride_w, dilation_h, dilation_w, height_col,
width_col, data_col);
Run Code Online (Sandbox Code Playgroud)
当我对 im2col_gpu_kernel 函数进行评论时,我发现有大量关于该函数的调用。
所以我猜测“<<<>>>”这段代码进行循环(如for,while)调用func。
是吗?或者还有其他角色吗?这段代码是 c++ std 库吗?
我正在使用 U-net 架构训练分割模型。输入图像尺寸为250x250。
目前,我已经手动调整了一些卷积层的填充,以确保模型输出具有相同的大小,即 250x250。
但是,当我输入不同尺寸的图像(例如 500x500 的图像)时,输出尺寸为 506x506。
如何确保所有尺寸的输出尺寸与输入尺寸保持相同?
machine-learning computer-vision image-segmentation deep-learning caffe
我在我的双启动笔记本电脑上成功安装了caffe(GTX 860M,Windows 7 + Ubuntu 14.04.2).所有测试都顺利通过.然而,当我重新启动时,ubuntu卡在了打开的屏幕上(带有ubuntu徽标和五个红点的那个).不知道该怎么做.
有没有人遇到过同样的问题?我认为显卡驱动程序启动有问题.我安装了最新的CUDA 7 Toolkit,内置了nvidia驱动程序.由于在重新启动之前所有测试都已通过,因此驱动程序在成功启动后似乎可以正常工作.
卡住的屏幕是这样的:http://i.stack.imgur.com/pRtEF.jpg
我已经使用Debug标志编译了caffe.现在我跑的时候
./examples/mnist/train_lenet.sh
Run Code Online (Sandbox Code Playgroud)
我得到输出
I0112 22:50:49.680357 114020 data_layer.cpp:103] Read time: 0.095 ms.
I0112 22:50:49.680376 114020 data_layer.cpp:104] Transform time: 0.821 ms.
I0112 22:50:49.681077 113921 solver.cpp:409] Test net output #0: accuracy = 0.9902
I0112 22:50:49.681115 113921 solver.cpp:409] Test net output #1: loss = 0.0292544 (* 1 = 0.0292544 loss)
I0112 22:50:49.681125 113921 solver.cpp:326] Optimization Done.
I0112 22:50:49.681133 113921 caffe.cpp:215] Optimization Done.
I0112 22:50:49.681915 114020 data_layer.cpp:102] Prefetch batch: 1 ms.
I0112 22:50:49.681929 114020 data_layer.cpp:103] Read time: 0.095 ms.
I0112 22:50:49.681948 114020 data_layer.cpp:104] Transform time: …Run Code Online (Sandbox Code Playgroud) 我正在阅读caffe源代码.
我很困惑LayerSetUp和Reshape方法.
有些层有这两种方法,有些层有一层或没有...为什么?任何人都可以向我解释这个吗?
现在,我是带有2类数据的火车网络...但是在第一次迭代后精度是恒定的1!
输入数据是灰度图像.当HDF5Data创建时,两个类图像都是随机选择的.
为什么会这样?怎么了,错在哪里!
network.prototxt:
name: "brainMRI"
layer {
name: "data"
type: "HDF5Data"
top: "data"
top: "label"
include: {
phase: TRAIN
}
hdf5_data_param {
source: "/home/shivangpatel/caffe/brainMRI1/train_file_location.txt"
batch_size: 10
}
}
layer {
name: "data"
type: "HDF5Data"
top: "data"
top: "label"
include: {
phase: TEST
}
hdf5_data_param {
source: "/home/shivangpatel/caffe/brainMRI1/test_file_location.txt"
batch_size: 10
}
}
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
convolution_param {
num_output: 20
kernel_size: 5
stride: 1 …Run Code Online (Sandbox Code Playgroud) machine-learning training-data neural-network deep-learning caffe
#include <algorithm>
#include <vector>
template <typename Dtype>
__global__ void R_D_CUT(const int n, Dtype* r, Dtype* d
, Dtype cur_r_max, Dtype cur_r_min, Dtype cur_d_max, Dtype cur_d_min) {
CUDA_KERNEL_LOOP(index, n) {
r[index] = __min(cur_r_max, __max(r[index], cur_r_min));
d[index] = __min(cur_d_max, __max(d[index], cur_d_min));
}
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,它可以在Window中很好地工作.但是,由于__min和__max功能,它在Ubuntu中不起作用.要修复它通过更换__min到std::min<Dtype>和 max到std::max<Dtype>:
template <typename Dtype>
__global__ void R_D_CUT(const int n, Dtype* r, Dtype* d
, Dtype cur_r_max, Dtype cur_r_min, Dtype cur_d_max, Dtype cur_d_min) {
CUDA_KERNEL_LOOP(index, n) {
r[index] …Run Code Online (Sandbox Code Playgroud) 我在Ubuntu下成功编译了Caffe,并开始研究如何定义和训练自己的网络。但是,我很难理解卷积层如何产生其输出。例如,LeNet MNIST教程(tutorial,lenet.prototxt)的第二个卷积层(conv2 )具有20个输入图像和50个输出图像:
layer {
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
convolution_param {
num_output: 50
kernel_size: 5
stride: 1
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
Run Code Online (Sandbox Code Playgroud)
如何O_0, ..., O_49计算输出图像?我的直觉是,它的工作方式如下(I_i输入图像,K_j内核,B_k偏差,*卷积运算符):
O_0 = I_0 * K_0 + ... + I_19 * K_19 + B_0
O_1 = I_0 * K_20 + ... …Run Code Online (Sandbox Code Playgroud) Caffe有reshape层实现,但说我想先重塑的一个blob (1, n, k, p)来(1, a, b, k, p),在那里n= a*b,然后调换它塑造(1, b, a, k, p),如何实现这种操作,我知道我可以写一个单独的蟒蛇层,做这一切与numpy.reshape和numpy.transpose,但是这将是不高效,是吗?
machine-learning computer-vision neural-network deep-learning caffe
caffe ×10
cuda ×3
c++ ×2
boost ×1
convolution ×1
pycaffe ×1
python ×1
syntax ×1
ubuntu-14.04 ×1