{"action":"created","issue":{"url":"https://api.github.com/repos/BVLC/caffe/issues/512","repository_url":"https://api.github.com/repos/BVLC/caffe","labels_url":"https://api.github.com/repos/BVLC/caffe/issues/512/labels{/name}","comments_url":"https://api.github.com/repos/BVLC/caffe/issues/512/comments","events_url":"https://api.github.com/repos/BVLC/caffe/issues/512/events","html_url":"https://github.com/BVLC/caffe/issues/512","id":35888635,"number":512,"title":"How to do regression?","user":{"login":"XucongZhang","id":5663889,"avatar_url":"https://avatars.githubusercontent.com/u/5663889?v=3","gravatar_id":"","url":"https://api.github.com/users/XucongZhang","html_url":"https://github.com/XucongZhang","followers_url":"https://api.github.com/users/XucongZhang/followers","following_url":"https://api.github.com/users/XucongZhang/following{/other_user}","gists_url":"https://api.github.com/users/XucongZhang/gists{/gist_id}","starred_url":"https://api.github.com/users/XucongZhang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XucongZhang/subscriptions","organizations_url":"https://api.github.com/users/XucongZhang/orgs","repos_url":"https://api.github.com/users/XucongZhang/repos","events_url":"https://api.github.com/users/XucongZhang/events{/privacy}","received_events_url":"https://api.github.com/users/XucongZhang/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":47,"created_at":"2014-06-17T13:31:26Z","updated_at":"2016-03-10T05:59:28Z","closed_at":"2014-06-23T14:53:04Z","body":"Hi,\r\nI am trying to modify the mnist example to be a regression network. I just changed the loss layer from \"SOFTMAX_LOSS\" to \"EUCLIDEAN_LOSS\", and \"num_output\" of ip2 layer to be 1 instead of 10. But I got the result like this:\r\n\r\nI0617 15:26:45.970600 10216 solver.cpp:141] Iteration 0, Testing net (#0)\r\nI0617 15:26:47.555521 10216 solver.cpp:179] Test score #0: 1\r\nI0617 15:26:47.555577 10216 solver.cpp:179] Test score #1: 0\r\nI0617 15:26:51.046875 10216 solver.cpp:274] Iteration 100, lr = 0.00992565\r\nI0617 15:26:51.047067 10216 solver.cpp:114] Iteration 100, loss = nan\r\nI0617 15:26:54.535904 10216 solver.cpp:274] Iteration 200, lr = 0.00985258\r\nI0617 15:26:54.536092 10216 solver.cpp:114] Iteration 200, loss = nan\r\nI0617 15:26:58.024719 10216 solver.cpp:274] Iteration 300, lr = 0.00978075\r\nI0617 15:26:58.024911 10216 solver.cpp:114] Iteration 300, loss = nan\r\nI0617 15:27:01.514154 10216 solver.cpp:274] Iteration 400, lr = 0.00971013\r\nI0617 15:27:01.514345 10216 solver.cpp:114] Iteration 400, loss = nan\r\nI0617 15:27:05.003473 10216 solver.cpp:274] Iteration 500, lr = 0.00964069\r\nI0617 15:27:05.003661 10216 solver.cpp:114] Iteration 500, loss = nan\r\nI0617 15:27:05.003675 10216 solver.cpp:141] Iteration 500, Testing net (#0)\r\nI0617 15:27:06.572185 10216 solver.cpp:179] Test score #0: 1\r\nI0617 15:27:06.572234 10216 solver.cpp:179] Test score #1: nan\r\nI0617 15:27:10.060245 10216 solver.cpp:274] Iteration 600, lr = 0.0095724\r\nI0617 15:27:10.060436 10216 solver.cpp:114] Iteration 600, loss = nan\r\n\r\n\r\nCan anyone help me with it, or could you give me a example to do regression with Caffe?\r\nThank you very much!\r\n---------------------------------------------------------------------------------------------------------------\r\nUpdates:\r\nJust in case anyone wants to work on multi-label regression problem, please refer to our project webpage:\r\nhttps://www.mpi-inf.mpg.de/departments/computer-vision-and-multimodal-computing/research/gaze-based-human-computer-interaction/appearance-based-gaze-estimation-in-the-wild/\r\nIn the \"Method\" part, you will find my configuration file as well as the Matlab code convert .mat to .h5\r\nP.S. Thanks to https://github.com/BVLC/caffe/pull/1746, that is a time saver!"},"comment":{"url":"https://api.github.com/repos/BVLC/caffe/issues/comments/194686382","html_url":"https://github.com/BVLC/caffe/issues/512#issuecomment-194686382","issue_url":"https://api.github.com/repos/BVLC/caffe/issues/512","id":194686382,"user":{"login":"chriss2401","id":14329867,"avatar_url":"https://avatars.githubusercontent.com/u/14329867?v=3","gravatar_id":"","url":"https://api.github.com/users/chriss2401","html_url":"https://github.com/chriss2401","followers_url":"https://api.github.com/users/chriss2401/followers","following_url":"https://api.github.com/users/chriss2401/following{/other_user}","gists_url":"https://api.github.com/users/chriss2401/gists{/gist_id}","starred_url":"https://api.github.com/users/chriss2401/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chriss2401/subscriptions","organizations_url":"https://api.github.com/users/chriss2401/orgs","repos_url":"https://api.github.com/users/chriss2401/repos","events_url":"https://api.github.com/users/chriss2401/events{/privacy}","received_events_url":"https://api.github.com/users/chriss2401/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T05:59:28Z","updated_at":"2016-03-10T05:59:28Z","body":"@smajida as you may know, when you imread an image on MATLAB the dimensions are HxWxC (height width channels). Caffe works with WxHxC. Therefore before using the hdf5 functions to write your data you should permute in the following way.\r\n\r\nim = permute(im,[2 1 3]);\r\n\r\nof course you have a fourth channel, but you get my idea. Once you flip the width and height you should be good to go. As for the regression problem I'm not 100 percent sure. @XucongZhang 's project has an accuracy layer but when I use it in my project (regression through RNN) it outputs some crazy values (like 20+). So I removed it as some other people mentioned in here and I'm looking at results. But I'm not sure how it will work because your GT size is different from your data (800 800 versus 800 800 3). Right now I'm using GT of 10x4 and data of 10x4x256x28x28 (scalar for each image)."}}