{"action":"created","issue":{"url":"https://api.github.com/repos/wanglimin/TDD/issues/3","labels_url":"https://api.github.com/repos/wanglimin/TDD/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/wanglimin/TDD/issues/3/comments","events_url":"https://api.github.com/repos/wanglimin/TDD/issues/3/events","html_url":"https://github.com/wanglimin/TDD/issues/3","id":96563868,"number":3,"title":"FlowCNNFeature.m","user":{"login":"kli-nlpr","id":13194870,"avatar_url":"https://avatars.githubusercontent.com/u/13194870?v=3","gravatar_id":"","url":"https://api.github.com/users/kli-nlpr","html_url":"https://github.com/kli-nlpr","followers_url":"https://api.github.com/users/kli-nlpr/followers","following_url":"https://api.github.com/users/kli-nlpr/following{/other_user}","gists_url":"https://api.github.com/users/kli-nlpr/gists{/gist_id}","starred_url":"https://api.github.com/users/kli-nlpr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kli-nlpr/subscriptions","organizations_url":"https://api.github.com/users/kli-nlpr/orgs","repos_url":"https://api.github.com/users/kli-nlpr/repos","events_url":"https://api.github.com/users/kli-nlpr/events{/privacy}","received_events_url":"https://api.github.com/users/kli-nlpr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-22T13:07:51Z","updated_at":"2015-07-22T13:14:28Z","closed_at":"2015-07-22T13:14:05Z","body":"Hi, LiMin\r\nThe code in FlowCNNFeature.m\r\n```\r\nfunction FCNNFeature = FlowCNNFeature(vid_name, use_gpu, NUM_HEIGHT, NUM_WIDTH, model_def_file, model_file, gpu_id)\r\nL = 10;\r\n% Input video\r\nfilelist =dir([vid_name,'*_x*.jpg']);\r\nif length(filelist) > 30 *60\r\n    video = zeros(NUM_HEIGHT,NUM_WIDTH,L*2,30*60,'single');\r\nelse\r\n    video = zeros(NUM_HEIGHT,NUM_WIDTH,L*2,length(filelist),'single');\r\nend\r\n\r\nfor i = 1:size(video,4)\r\n    flow_x = imread(sprintf('%s_%06d.jpg',[vid_name,'flow_x'],i));\r\n    flow_y = imread(sprintf('%s_%06d.jpg',[vid_name,'flow_y'],i));\r\n    video(:,:,1,i) = imresize(flow_x,[NUM_HEIGHT,NUM_WIDTH],'bilinear');\r\n    video(:,:,2,i) = imresize(flow_y,[NUM_HEIGHT,NUM_WIDTH],'bilinear');\r\nend\r\n\r\nfor i = 1:L-1% \r\n    tmp = cat(4, video(:,:,(i-1)*2+1:i*2,2:end),video(:,:,(i-1)*2+1:i*2,end));%240*320*2*54\r\n    video(:,:,i*2+1:i*2+2,:)  = tmp;\r\nend\r\n```\r\n**I find it hard to understand the code** \r\n```\r\nfor i = 1:L-1% \r\n    tmp = cat(4, video(:,:,(i-1)*2+1:i*2,2:end),video(:,:,(i-1)*2+1:i*2,end));%\r\n    video(:,:,i*2+1:i*2+2,:)  = tmp;\r\nend\r\n```\r\nFor example there are 55 frames in a video, so the variable **video**'s shape is (240 320 20 55).\r\nFor every frame, there are 20 flow images with size 240*320 corresponds to it.\r\nAccording to the code, for every frame, the first two flow image are flow_x and flow_y, the remaining 18 flow images are just the copy of the first two?\r\nDoes this make sense? \r\n\r\nWhy not just use\r\n```\r\n tmp =video(:,:,(i-1)*2+1:i*2,1:end);\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/wanglimin/TDD/issues/comments/123715684","html_url":"https://github.com/wanglimin/TDD/issues/3#issuecomment-123715684","issue_url":"https://api.github.com/repos/wanglimin/TDD/issues/3","id":123715684,"user":{"login":"wanglimin","id":7599642,"avatar_url":"https://avatars.githubusercontent.com/u/7599642?v=3","gravatar_id":"","url":"https://api.github.com/users/wanglimin","html_url":"https://github.com/wanglimin","followers_url":"https://api.github.com/users/wanglimin/followers","following_url":"https://api.github.com/users/wanglimin/following{/other_user}","gists_url":"https://api.github.com/users/wanglimin/gists{/gist_id}","starred_url":"https://api.github.com/users/wanglimin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wanglimin/subscriptions","organizations_url":"https://api.github.com/users/wanglimin/orgs","repos_url":"https://api.github.com/users/wanglimin/repos","events_url":"https://api.github.com/users/wanglimin/events{/privacy}","received_events_url":"https://api.github.com/users/wanglimin/received_events","type":"User","site_admin":false},"created_at":"2015-07-22T13:14:28Z","updated_at":"2015-07-22T13:14:28Z","body":"According to the code, for every frame, the first two flow image are flow_x\nand flow_y, the remaining 18 flow images are just the copy of the first two?\n\nYour understanding is wrong. To make sure the temporal duration of\nconvolutional feature map is equal to the duration of video. So we pad the\n(L-1) frame optical flow field at the end.\n\nYou can try some other smarter method such as interpolation.\n\n\nOn Wed, Jul 22, 2015 at 9:09 PM, WANG Limin <lmwang.nju@gmail.com> wrote:\n\n> You can try some other smarter method such as interpolation.\n>\n> On Wed, Jul 22, 2015 at 9:07 PM, Kai Li <notifications@github.com> wrote:\n>\n>> Hi, LiMin\n>> The code in FlowCNNFeature.m\n>>\n>> function FCNNFeature = FlowCNNFeature(vid_name, use_gpu, NUM_HEIGHT, NUM_WIDTH, model_def_file, model_file, gpu_id)\n>> L = 10;\n>> % Input video\n>> filelist =dir([vid_name,'*_x*.jpg']);\n>> if length(filelist) > 30 *60\n>>     video = zeros(NUM_HEIGHT,NUM_WIDTH,L*2,30*60,'single');\n>> else\n>>     video = zeros(NUM_HEIGHT,NUM_WIDTH,L*2,length(filelist),'single');\n>> end\n>>\n>> for i = 1:size(video,4)\n>>     flow_x = imread(sprintf('%s_%06d.jpg',[vid_name,'flow_x'],i));\n>>     flow_y = imread(sprintf('%s_%06d.jpg',[vid_name,'flow_y'],i));\n>>     video(:,:,1,i) = imresize(flow_x,[NUM_HEIGHT,NUM_WIDTH],'bilinear');\n>>     video(:,:,2,i) = imresize(flow_y,[NUM_HEIGHT,NUM_WIDTH],'bilinear');\n>> end\n>>\n>> for i = 1:L-1%\n>>     tmp = cat(4, video(:,:,(i-1)*2+1:i*2,2:end),video(:,:,(i-1)*2+1:i*2,end));%240*320*2*54\n>>     video(:,:,i*2+1:i*2+2,:)  = tmp;\n>> end\n>>\n>> *I find it hard to understand the code*\n>>\n>> for i = 1:L-1%\n>>     tmp = cat(4, video(:,:,(i-1)*2+1:i*2,2:end),video(:,:,(i-1)*2+1:i*2,end));%\n>>     video(:,:,i*2+1:i*2+2,:)  = tmp;\n>> end\n>>\n>> For example there are 55 frames in a video, so the variable *video*'s\n>> shape is (240*320*20\n>> *55). For every frame, there are 20 flow images with size 240*320\n>> corresponds to it.\n>> According to the code, for every frame, the first two flow image are\n>> flow_x and flow_y, the remaining 18 flow images are just the copy of the\n>> first two?\n>> Does this make sense?\n>>\n>> Why not just use\n>>\n>>  tmp =video(:,:,(i-1)*2+1:i*2,1:end);\n>>\n>> —\n>> Reply to this email directly or view it on GitHub\n>> <https://github.com/wanglimin/TDD/issues/3>.\n>>\n>\n>\n>\n> --\n> WANG Limin\n> Postgraduate of Department of Information Engineering, CUHK, Hong Kong.\n> Undergraduate of Department of Computer Science and Technology, NJU, China.\n>\n>\n\n\n-- \nWANG Limin\nPostgraduate of Department of Information Engineering, CUHK, Hong Kong.\nUndergraduate of Department of Computer Science and Technology, NJU, China.\n"}}