dgschwend / zynqnet

Master Thesis "ZynqNet: An FPGA-Accelerated Embedded Convolutional Neural Network"
GNU General Public License v3.0
737 stars 297 forks source link

Image Pixel Values Range #31

Open wasim6691 opened 6 years ago

wasim6691 commented 6 years ago

Hi David

I want to ask You that If i convert the hexadecimal values from the "indata.bin" file into the corresponding floating point values then What range of the values should I expect ? . At the moment I am getting the range of the pixels values in negative and positive both. Is there any defined range of pixel values e.g. (0, 255) or (-255, 255) etc. Hoping for an early response. Thanks

Best Regards Khan

dgschwend commented 6 years ago

Good question! As you can see in the conversion script https://github.com/dgschwend/zynqnet/blob/master/tools/convert_jpeg_to_indata_bin.py, Zynqnet expects inputs between 0-255, but with the ImageNet mean vales [104, 117, 123] subtracted.

dgschwend commented 6 years ago

I.e. the floating-point range will be approximately -123 to +151, depending on the channel (R/G/B)

wasim6691 commented 6 years ago

I am reading the indata.bin file and making a 3d array for storing the pixel values. The array pattern is [channels][height][Width]. Is that pattern ok ? But I have not subtracted any mean value from the values which I m reading from the binary file ?

On Jan 9, 2018 7:23 PM, "David Gschwend" notifications@github.com wrote:

I.e. the floating-point range will be approximately -123 to +151, depending on the channel (R/G/B)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dgschwend/zynqnet/issues/31#issuecomment-356370571, or mute the thread https://github.com/notifications/unsubscribe-auth/AWR6hSC8_gs-tws1X1_NtasuiDL3tYJiks5tI66KgaJpZM4RX2QD .

dgschwend commented 6 years ago

CHW order is correct. Beware of BGR color channels. See the linked script for the conversion from JPG -> indata.bin, it says all about the conversion. Why are you trying to interpret the binary file, by the way?

wasim6691 commented 6 years ago

The binary file indata.bin is of specific image right?. So I am reading the values from the binary file and trying to implement the first layer my self. Can we use the binary file as image pixel file. The values inside are in hexa and I m interpreting 4 hex values as 1 floating point value ? Is that right or wrong ?

On Jan 9, 2018 7:49 PM, "David Gschwend" notifications@github.com wrote:

CHW order is correct. Beware of BGR color channels. See the linked script for the conversion from JPG -> indata.bin, it says all about the conversion. Why are you trying to interpret the binary file, by the way?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dgschwend/zynqnet/issues/31#issuecomment-356377851, or mute the thread https://github.com/notifications/unsubscribe-auth/AWR6hT2Ht5ZVrr5ibEPmJkfw92PYHt5sks5tI7TVgaJpZM4RX2QD .

wasim6691 commented 6 years ago

Hi David

Please Answer the Above question.

One More question is that why are you subtracting the mean values for the ImageNet image Set. Can You please explain the reason behind tat. Thanks for your time. Keenly looking forward for your reply.

dgschwend commented 6 years ago

Your assumptions are correct.

The network has been trained with mean-subtracted images, therefore needs mean-subtraction also during inference. There‘s some debate whether this is necessary in the Deep Learning community, but it‘s standard in the DIGITS framework I trained the network with.

wasim6691 commented 6 years ago

HI David

I am.getting the floating point values in the range of -123 to 151 as you have mentioned before. What do you think it would be ok to use these as pixels values for deep neural networks like zynqnet. I am using these and multiplying with the weights values to get the next layer values.? Thanks

On Jan 10, 2018 8:38 AM, "David Gschwend" notifications@github.com wrote:

Your assumptions are correct.

The network has been trained with mean-subtracted images, therefore needs mean-subtraction also during inference. There‘s some debate whether this is necessary in the Deep Learning community, but it‘s standard in the DIGITS framework I trained the network with.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dgschwend/zynqnet/issues/31#issuecomment-356523442, or mute the thread https://github.com/notifications/unsubscribe-auth/AWR6hZ7QFh2k-lPIMLJR5fo3o1exU36rks5tJGjZgaJpZM4RX2QD .