Conversation
wangyida
commented
Sep 27, 2015
- 3D object recognition and face recognition samples
- 2 types of triplet loss for loss
- free number of sets for triplet loss
|
@bhack @shelhamer @mtamburrano This is a newly rebased PR for triplet loss, I just added a face recognition sample in the examples for general using. |
|
@wangyida when making changes please update your existing PR instead of opening a new PR. You can update a PR at any time by force pushing |
|
And I think you are still incorporating changes that you don't want to propose here. Review file changes of this PR. Do you really want this? |
|
Probably you want to razionalize the two commits. |
399ae68 to
2a12c1a
Compare
|
Now two more changes in file mode is restored, I accidentally reset a commit version earlier than my first commit in the other PR, so I reopened here, it might also be able to reopen the disabled PR? |
b5012ba to
f2fc582
Compare
|
Ok changes seems isolated now. I think you can continue here. Next time close and reopen a new one only in particular cases. |
|
Is this ready for a review pass now? |
|
@bhack Yes, sure~ |
|
@shelhamer Can you make a first quick pass? |
|
On using your triplet loss layer, I encountered an error which raised a SIGSEGV The problem seems to be arising on using |
|
@IMG-PRCSNG I have run the GPU codes on K40 and there seems no problem in the latest codes, I used to encounter some problems in the gpu_data of some metric operation functions, so I changed it to a cpu_data as the same data are stored also which could be used. |
|
Currently I am using only the CPU part of the code which doesn't throw any error. I find no reason why the GPU code should fail. I will try it out with cpu_data as you suggested. Thanks! |
|
@wangyida Great job on the triplet loss. I am slightly confused though about how the filelists for the Image Data layer should be created. Can you provide an example ? Are the triplets generated online per batch ? |
|
@swamiviv As for the object pose related issue, you can have a look in the code in the training data generation code using leveldb, and for other free style using manner of training data, you can just have a reference on this one, it is the same algorithm on training samples arrangement style using filelist #2982 |
|
Thanks a lot! On Thu, Oct 15, 2015 at 10:43 PM, Yida Wang notifications@github.com
--Swami |
|
HI Yida, I tried your triplet loss implementation but got errors when using GPU mode: |
|
I get the same error too. Was it resolved ? On Sun, Oct 25, 2015 at 10:26 PM, cysin notifications@github.com wrote:
--Swami |
|
@cysin OK, Let me have a check on the GPU codes. |
|
/cc @vpisarev for opencv/opencv_contrib#276 |
|
I see that you try to access on |
|
@mtamburrano I encountered some GPU memory issues that time when I using the matrix dot function defined in CUDA, so I change to use cpu_data instead cause this function seems able to have a cpu_data backup at the same time when it is used. |
|
I see that caffe_gpu_dot call cublasSdot or cublasDdot. How that could handle host pointers? |
|
@bhack OK, I will have a deeper check on it, I used to succeeded on a K80 server with this code and I find that caffe_gpu_dot is seldom used in all GPU codes of layers. |
|
@wangyida Yes it is used but I cannot find any layer that use it with CPU pointers cause it is a wrapper call on cublas. |
|
Thanks @wangyida . Reading previous comments and some of the code I think things are following into place... So in theory one could just use the examples/imagenet/create_imagenet.sh to convert an image list to a LMDB, and if the list is like the following ( assuming 3 negative samples), it will be okay. And I do need to be carefurell to set batch as a multiple of 5. Are my intuitions correct ? So it seems to be working with the solver_type = CPU, but whenever I use the GPU I also get a error in the forward pass. |
|
@igorbb I have tested my latest codes again on triplet loss type 0 and 1 for K40 GPU. There isn't such problem as you have described. Maybe you should pull the latest codes because I rebased all commits into a single commit. |
|
@wangyida I managed to get the previous commit running (with the labs Titan X) after some small modifications. |
|
Hey @wangyida |
|
@igorbb Good news, there are still some CPU operation in my GPU codes. Welcome anyone boosting the efficiency of it. |
|
@wangyida |
|
@wusongbeckham This is a linear operation function dependent on cblas, you could just have a reference on cblas headers. |
|
Hi, dear Yida, On Wed, Mar 9, 2016 at 1:33 AM, Yida Wang notifications@github.com wrote:
|
|
@wangyida |
|
@wusongbeckham The previous codes are written for early type of triplet and you could have a reference on examples/triplet/convert_triplet_data.cpp |
|
@wangyida |
|
@wusongbeckham Problem might be the fact that you are using a small batch size or the. The loss should be smaller in overall process. It also goes wrong if the samples are not properly arranged while you have selected too many negative samples. You can have a test on Losstype 0 while Losstype 1 and 2 are more efficient. |
|
@wangyida I just started digging into your implementation and example, but as @raingo and @igorbb suggested, it could be nice to have an end-to-end example, covering also the data preparation (a .pynb file is a good idea). Just to get started faster... |
|
@wangyida I am wondering if you or other people are doing online generation of triplets and how. It seems that this is a crucial step in the triplet learning process and I can't find any way to do this in Caffe. |
| message TripletLossParameter { | ||
| //margin for negative triplet | ||
| optional float margin = 1 [default = 1.0]; | ||
| optional uint32 losstype = 2 [default = 1]; |
There was a problem hiding this comment.
I think the code would be much more readable if this were a string or enum.
There was a problem hiding this comment.
@wusongbeckham
I user convert_triplet_data.bin convert Minist to levedb , but it is fail ,can you give me the create_minist_triple.sh ? thank you
|
hi,Hi, Yida: |
|
@bjutdy OK, I will upload my rendered training data from ShapeNet for recognition in PASCAL3D+ in dropbox, you could download it. |
|
@wangyida |
|
Hi, @wangyida are you working on this? Thanks for your efforts. There should be a small change. In src/caffe/proto/caffe.proto the triplet_loss_param cannot be 143 as it has already been used for input_param. I have assigned it 146 and it is compiling fine. |
|
Also, @wangyida could you please share the dropbox link for the data? |
|
Amazing work @wangyida. I'd like to implement triplet loss on a data set of my own. How should I label my data? (I'm trying to convert the data myself and am wondering what format to use to identify positive, negative, anchor, etc.) |
|
Is anyone else returning the following failed test: |
| #include "caffe/common.hpp" | ||
| #include "caffe/filler.hpp" | ||
| #include "caffe/vision_layers.hpp" | ||
|
|
There was a problem hiding this comment.
- Missing .cpp file extension
- Is '#include "caffe/vision_layers.hpp"' needed?
- Missing '#include "caffe/layers/triplet_loss_layer.hpp"'
|
@wangyida I don't really understand this problem. Could you describe this problem in more detail?
|