webdnn icon indicating copy to clipboard operation
webdnn copied to clipboard

Input 4 channels (RGBD) instead of 3 channels (RGB)

Open scaelles opened this issue 6 years ago • 4 comments

Hello,

The input of my network has 4 channels instead of the classical RGB. Would it be possible to add the option in Image.Color.RGBA for the Image.getImageArray function? Then, I could use the alpha channel for my extra channel.

Thanks a lot

scaelles avatar Apr 03 '18 18:04 scaelles

I experimentally added RGBA in #809. (merged to master. not yet released as npm) Since I don't have 4 channel model, reporting if this feature works is welcomed.

milhidaka avatar Apr 06 '18 05:04 milhidaka

Thanks a lot! I will try as soon as possible and let you know if it works.

scaelles avatar Apr 06 '18 11:04 scaelles

I have checked and I don't get the expected output. Here is the model if you need to check it. In Keras, I get the expected result that you can find in the output folder, but I get a different result in the browser. Let me know if I can help you with anything else. Thanks

scaelles avatar Apr 08 '18 10:04 scaelles

Thanks for reporting. I checked the output contains stripe pattern. It may be due to some implementation mismatch between keras and webdnn about convolution. We need to compare which layer causes the mismatch. Would you upload your keras model (python code and weight)?

If you are willing to debug it by yourself,

  • Get model which output intermediate layer output https://keras.io/getting-started/faq/#how-can-i-obtain-the-output-of-an-intermediate-layer
  • Supply sample image to the model and check the output on python console
  • Convert the model with webdnn
  • Run the model on web browser with same image and check the values in webdnn_output_view
  • If the outputs seems to match (mostly not exactly match due to rounding error), choice another intermediate layer closer to the output, and repeat the steps again

These steps are bothering, but currently I don't have better way to debug it.

milhidaka avatar Apr 08 '18 11:04 milhidaka