Giter Site home page Giter Site logo

darknet2caffe's Introduction

Darknet2Caffe

DarkNet下训练的yolo的.cfg文件和.weights文件转换为Caffe的.prototxt文件和.caffemodel文件

根目录执行命令:

python darknet2caffe.py yolov2_tiny_3.cfg yolov2_tiny_3.weights yolov2_tiny_3.prototxt yolov2_tiny_3.caffemodel

其中:

  1. yolov2_tiny_3.cfg --------- 模型结构文件,这里是一个3个类别的目标检测模型

  2. yolov2_tiny_3.weights ----- 训练好的模型权重文件

  3. yolov2_tiny_3.prototxt ---- 待生成的Caffe框架下的模型结构文件

  4. yolov2_tiny_3.caffemodel -- 待生成的Caffe框架下的模型权重文件

注:

  1. 上面我准备好的4个文件下载链接:链接: https://pan.baidu.com/s/1di7UxmJkUmkN3vgvlJOVFQ 提取码: ckd2

  2. 修改darknet2caffe.py中的Caffe路径(路径为Caffe的根目录,从官方GitHub下载并正常安装,可参考:https://blog.csdn.net/lwplwf/article/details/82415620)

  3. 修改yolov2_tiny_3.prototxt文件(和Caffe下region层的实现有关)

将第一层

input: "data"
input_dim: 1
input_dim: 3
input_dim: 416
input_dim: 416

修改为:

layer {
  name: "data"
  type: "Input"
  top: "data"
  input_param { shape: { dim: 1 dim: 3 dim: 416 dim: 416 } }
}

最后一层修改为:

layer {
        name: "detection_out"
        type: "YoloDetectionOutput"
        bottom: "layer15-conv"
        top: "detection_out"
        include {
                phase: TEST
        }
        yolo_detection_output_param {
                num_classes: 1
                coords: 4
                confidence_threshold: 0.4
                nms_threshold: 0.45
                biases: 1.08
                biases: 1.19
                biases: 3.42
                biases: 4.41
                biases: 6.63
                biases: 11.38
                biases: 9.42
                biases: 5.11
                biases: 16.62
                biases: 10.52
        }
}

修改pad

layer {
    bottom: "layer11-conv"
    top: "layer12-maxpool"
    name: "layer12-maxpool"
    type: "Pooling"
    pooling_param {
        kernel_size: 2
        stride: 1
        pool: MAX
        pad: 1
    }
}

Reference:

https://github.com/marvis/pytorch-caffe-darknet-convert

https://github.com/lwplw/caffe_yolov2

darknet2caffe's People

Contributors

lwplw avatar kenh1991 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.