multi-image-deepNet-SVBRDF-acquisition icon indicating copy to clipboard operation
multi-image-deepNet-SVBRDF-acquisition copied to clipboard

Trying to render the result

Open tobyclh opened this issue 3 years ago • 2 comments

Hi @valentin-deschaintre Thank you for this amazing work! I am trying to render the result generated from this repository but I think I am stuck after a couple days trying to figure it out.

python pixes2Material.py --mode test --output_dir **** --input_dir *** --batch_size 1 --input_size 256 --nbTargets 4 --useLog --which_direction AtoB --inputMode folder --maxImages 5 --feedMethod render --useCoordConv --checkpoint $checkpoint --imageFormat png --nbInputs 10 --renderingScene fixedAngle

In the input directory I prepared the map as follow test

But I got the following error.

Traceback (most recent call last):
  File "pixes2Material.py", line 403, in <module>
    main()
  File "pixes2Material.py", line 276, in main
    filesets = test(sess, data, max_steps, display_fetches, output_dir = a.output_dir)
  File "pixes2Material.py", line 310, in test
    results = sess.run(display_fetches)
  File "/home/toby/anaconda3/envs/flexible_brdf_36/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 956, in run
    run_metadata_ptr)
  File "/home/toby/anaconda3/envs/flexible_brdf_36/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/toby/anaconda3/envs/flexible_brdf_36/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run
    run_metadata)
  File "/home/toby/anaconda3/envs/flexible_brdf_36/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError:  Number of ways to split should evenly divide the split dimension, but got split_dim 1 (size = 1536) and num_split 9
         [[{{node Split_input_data}}]]
         [[load_images/IteratorGetNext]]

additionally, it did render something, the light position seems to be fixed instead of random as expected in the code. in noAugmentationCorrectViewFixedTestSet there are ~100 images that looked the same to me with no light position/angle variants

Would you please kindly let me know how I can fix it? Thank you!

tobyclh avatar Jan 09 '22 04:01 tobyclh

Hi,

The error you are getting is the data loader trying to split the input file you provide in 9 (4 targets + 5 inputs I guess), but it seems the data it's trying to split is only 6x256 and not 9x256. I think that with your current parameters it will try to loop from one to 5 input images. Can you upload one of the image that was created in oAugmentationCorrectViewFixedTestSet? After reading the code (sorry, testhelper was a bit deadline last minute written), I believe that l.130 and l.143 I left the wrong function uncommented. Can you replace display_images_fetches_fullTest by the commented display_images_fetches and save_images_fullPath by the commented save_images (you may need to add the step number to the saved image name so they don't override each other as they are written).

Let me know how that goes.

(for completeness, feel free to ignore this paragraph:) The functions display_images_fetches_fullTest and save_images_fullPath can only be used with the renderingScene "globalTestScene" (and it requires a nbInput of 2n+1 where n is the number of renderings you want for each of SurfaceLightFixedView and HemishpereLightFixedView). But you then have to restart the network on the generated renderings with a "file" loading mode as nbInput will be incorrect now that the renderings where subdivided in 1, n, n renderings.

About the fact that your images are all looking the same, it's because you have the parameter --renderingScene fixedAngle which only generates renderings with a specified angle. For the list of available scenes it's here:["staticViewPlaneLight", "staticViewSpotLight", "staticViewHemiSpotLight", "staticViewHemiSpotLightOneSurface", "movingViewHemiSpotLightOneSurface", "fixedAngles", "globalTestScene"]. They are defined in acquisitionScene.py

Generally static view = view doesn't move, SpotLight = it's a spot light rather than a point light used in the rendering and plane/Hemi define if the light is sampled on a place above the material or an hemisphere.

Best,

valentin-deschaintre avatar Jan 09 '22 16:01 valentin-deschaintre

Thank you for the quick response!

I think that with your current parameters it will try to loop from one to 5 input images. Can you upload one of the image that was created in oAugmentationCorrectViewFixedTestSet?

Yes, I think it produces two render in one image file, but I can't seem to figure which parameter controls this behaviour 0_test

(I am under the impression that nbInputs is only relevant when you are testing using feedMethod=file?

(for completeness, feel free to ignore this paragraph:) The functions display_images_fetches_fullTest and save_images_fullPath can only be used with the renderingScene "globalTestScene" (and it requires a nbInput of 2n+1 where n is the number of renderings you want for each of SurfaceLightFixedView and HemishpereLightFixedView). But you then have to restart the network on the generated renderings with a "file" loading mode as nbInput will be incorrect now that the renderings where subdivided in 1, n, n renderings.

I cannot say that I fully understand what you say here, but when I did replace the two functions (and some other minor bug fix) it is working now! If you prefer I can open a PR for that, please let me know!! Thank you!

tobyclh avatar Jan 10 '22 07:01 tobyclh