szagoruyko / cvpr15deepcompare

Code and models for "Learning to Compare Image Patches via Convolutional Neural Networks"
http://imagine.enpc.fr/~zagoruys/deepcompare.html
Other
468 stars 169 forks source link

training by caffe tool #27

Open shawnlee103 opened 7 years ago

shawnlee103 commented 7 years ago

I already try the default siamese network via caffe tool successfuly. So i know a little operation for caffe.

Now if i want to use caffe to train my own data(via 2ch or 2chdeep network), (my data image with only one channel(8UC1)) 1. how do I prepare the data set format? As I know the caffe accept LMDB and LEVELDB, should i mix two image to a two-channel image by other tool(how?)? then convert to lmdb or better way to do this?

2. how do i config the training prototxt according above dataset?

3. according to cvpr2015\2ch\yosemite_deploy.txt..... input: "data" input_shape { dim: 10 <----- why 10? means "use 10 images at the same time"? so output 10 values? dim: 2 dim: 64 dim: 64 }

shawnlee103 commented 7 years ago

update myself

  1. I already know how to prepare my data according caffe/examples/siamese/convert_mnist_siamese_data.cpp ... caffe::Datum datum; datum.set_channels(2); // one channel for each image in the pair datum.set_height(rows); datum.set_width(cols); .... modify the cpp could make two channel dataset for caffe

  2. for now I use the hinge loss layer instead to the hinge loss function proposed from paper i tried to make the prototxt
    .... layer { name: "caffe_InnerProduct_9" type: "InnerProduct" bottom: "caffe_Flatten_8" top: "caffe_InnerProduct_9" inner_product_param { num_output: 2 axis: -1 } } layer { name: "accuracy" type: "Accuracy" bottom: "caffe_InnerProduct_9" bottom: "label" top: "accuracy" include { phase: TEST } } layer { name: "loss" type: "HingeLoss" bottom: "caffe_InnerProduct_9" bottom: "label" top: "loss" hinge_loss_param { norm: L2 } } but seems weird? the accuracy only 0.76XXXX I tried the siamese for the same dataset, i could get accuracy 0.94. who did i do wrong? (i made my dataset for two classed, label:0 and label:1)

  3. I still confused....

szagoruyko commented 7 years ago

@shawnlee103 I've never used caffe for training, can't help here.