dgyoo / pa3

Recent image representation as PA3 of the computer vision class.
7 stars 0 forks source link

Question about vl_simplenn (20155004) #7

Closed 20155004 closed 8 years ago

20155004 commented 8 years ago

function res = vl_simplenn(net, x, dzdy, res, varargin)

how can i define dzdy and varagin when i use vl_simplenn in im2descAp.m?

Dong-JinKim commented 8 years ago

i am 20153080

usually, we don't need to set DZDY in activation extraction case, you can just let it empty.

varargin are some additional inputs or options you want to set, such as 'conserveMemory' or 'cudnn'. It is also not usually required in activation extraction.

so. you can just use

res = vl_simplenn(net, x, [], res);

in im2descAp.m

Jinwoo-Jeon commented 8 years ago

We only need to train fully-connnected part so they are needless. You can use only

res=vl_simplenn(net,x);

20155004 commented 8 years ago

Thank you. more questions

  1. how can i use the net.normalization,averageImage?
  2. vl_simplenn.m I tried it several times but it doesn't work well. Could you explain it's instruction more in detail? res = vl_simplenn(net, x, [], res); 다음 사용 중 오류가 발생함: vl_nnconv An input is not a SINGLE array nor it is empty.

error: vl_simplenn (line 193) res(i+1).x = vl_nnconv(res(i).x, l.weights{1}, l.weights{2}, ...

error: im2descAp (line 27) res = vl_simplenn(net, t, [], res);

Jinwoo-Jeon commented 8 years ago

6 for 2.

bismex commented 8 years ago

In your original question,

you can use res=vl_simplenn(net, img); and then you can get activation array in res(layer_ID+1).x you don't need to define dzdy and any varagin

In your another questions,

Answer :

you can use net.normalization.averageImage at your input image. you have to convert uint8 type into single type at the input image using single function. (if you use im2single function, range of your image will be [0~1], so you have to use single function) And then, your input image have to subtract averageImage like that : img = img - net.normalization.averageImage;

thank you, Choi seok eon (20153640)

20155004 commented 8 years ago

Thank you. but, each element of net.normalization.averageImage > 100
then img = img - net.normalization.averageImage has ( - ) value.
Is it right?

Jinwoo-Jeon commented 8 years ago

Yes, that process makes image zero-mean.

So, img should have ( - ) value

bismex commented 8 years ago

yes it makes zero mean. you can get more information in this homepage

http://www.vlfeat.org/matconvnet/quick/

If you don't subtract average of image, you will get about 25% accuracy rate. But, if you subtract this, you will get 60% accuracy rate or more

Thank you Choi seok eon (20153640)

20155004 commented 8 years ago

It works at first, but it doesn't work at all from next trial ^^;;;; Exactly Do you know why??

다음 사용 중 오류가 발생함: - 행렬의 차원이 일치해야 합니다.

오류 발생: im2descAp (line 23) t = img - net.normalization.averageImage;

img = single(im);

img = imresize(img,[224 224]);

20155004 commented 8 years ago

Exactly, During the first process, same error appears at certain point(35%~~) and then it doesn't work at all. 다음 사용 중 오류가 발생함: - 행렬의 차원이 일치해야 합니다.

오류 발생: im2descAp (line 23) t = img - net.normalization.averageImage

bismex commented 8 years ago

The size of net.normalization.averageImage matrix is all [224 224 3].

Therefore you will resize image to [224 224 3]

If image size will be [224 224 1], you have to convert [224 224 1] size into [224 224 3] size

You have to confirm the size of every images.

Thank you Choi seok eon (20153640)

20155004 commented 8 years ago

Thank you, I don't know there are gray scale image... Now it works.

bismex commented 8 years ago

I wrote some information about 8 bit jpeg image in #9

Thank you Choi seok eon (20153640)