windows+caffe+FlowNet2

少吐槽,多实践,长经验!


目录

介绍

下载

添加源文件

.cpp & .cu

.hpp

修改文件

\caffe\src\caffe\proto\caffe.proto

\caffe\include\caffe\layers\eltwise_layer.hpp

\caffe\src\caffe\layers\eltwise_layer.cpp

\caffe\src\caffe\layers\data_augmentation_layer.cpp 

\caffe\include\caffe\filler.hpp

重新cmake 工程

测试

BUG



介绍

Flownet2官方没有提供windows下VisualStudio可用的版本,博主对make不熟悉,就打算在caffe-windows-master的基础上实现Flownet2.

如果你需要在短时间内实现,可以从这里下载对应的修改部分,稍作替换即可.

https://download.csdn.net/download/qq_25379821/10562555


下载

caffe-windows-master 方法参考 window10+caffe+vs2015+cmake3.11.3+GPU 安装

flownet2-master  lmb-freiburg/flownet2

修改后的flownet2网络定义文件:https://download.csdn.net/download/qq_25379821/10562581


添加源文件

  • .cpp & .cu

\caffe\src\caffe\layers

accum_layer.cpp

accum_layer.cu

augmentation_layer_base.cpp

channel_norm_layer.cpp

channel_norm_layer.cu

correlation_layer.cpp

correlation_layer.cu

data_augmentation_layer.cpp

flow_warp_layer.cpp

flow_warp_layer.cu

neg_relu_layer.cpp

neg_relu_layer.cu

 

\caffe\src\caffe\util

output.cpp

rng.cpp


  • .hpp

\caffe\include\caffe\layers

accum_layer.hpp

augmentation_layer_base.hpp

channel_norm_layer.hpp

correlation_layer.hpp

data_augmentation_layer.hpp

flow_warp_layer.hpp

neg_relu_layer.hpp

 

\caffe\include\caffe\util

output.hpp


修改文件

\caffe\src\caffe\proto\caffe.proto

添加新增层的参数

message LayerParameter {
//.............
//添加
  //optional AllpassParameter allpass_param = 148;
  optional CoeffScheduleParameter coeff_schedule_param = 150;
  optional AugmentationParameter augmentation_param = 149;
  optional AccumParameter accum_param = 152;
  optional CorrelationParameter correlation_param = 153;
  optional FlowWarpParameter flow_warp_param = 154;
  optional ResampleParameter resample_param = 155;

  optional bool reshape_every_iter = 151 [default = true];

}

接着添加这些层参数的定义

message ResampleParameter {
    enum ResampleType {
        NEAREST = 1;
        LINEAR = 2;
        CUBIC = 3;
        AREA = 4;
    };
    optional bool antialias = 4 [ default = true ];
    optional uint32 width  = 1;
    optional uint32 height = 2;
    optional ResampleType type = 3 [ default = LINEAR ];
    optional float factor = 5 [ default = 1.0 ];
}



message FlowWarpParameter {
    enum FillParameter {
        ZERO = 1;
        NOT_A_NUMBER = 2;
    }

    optional FillParameter fill_value = 1 [ default = ZERO ];
}


message CorrelationParameter {
  optional uint32 pad = 2 [default = 0]; // The padding size (equal in Y, X)
  optional uint32 kernel_size = 3; // The kernel size (square)
  optional uint32 max_displacement = 4; // The maximum displacement (square)
  optional uint32 stride_1 = 5 [default = 1]; // The stride in blob 1 (equal in Y, X)
  optional uint32 stride_2 = 6 [default = 1]; // The stride in blob 2 (equal in Y, X)
  
  // For Correlation1D:
  optional int32 single_direction = 8 [default = 0]; // Correlate only to the left (-1) or right (1)
  
  optional bool do_abs = 7 [default = false]; // Use absolute value of result
  enum CorrelationType {
    MULTIPLY = 0;
    SUBTRACT = 1;
  }
  optional CorrelationType correlation_type = 15 [default = MULTIPLY]; // Multiplicative is normal correlation
}

message AccumParameter {
  optional uint32 top_height = 1 [default = 0]; // The output height
  optional uint32 top_width = 2 [default = 0]; // The output width
  optional uint32 size_divisible_by = 3 [default = 0]; // Upscales to the minimal size divisible by the given number
  optional bool have_reference = 4 [ default = false ];
}

message CoeffScheduleParameter {
  optional float half_life = 1 [default = 1];
  optional float initial_coeff = 2 [default = 1];
  optional float final_coeff = 3 [default = 1];
}


// Message storing the actual coefficients of a transf
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 19
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 19
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值