camenduru / Wonder3D-colab

80 stars 7 forks source link

custom image using Kaggle notebook #6

Open thevaibhavkute opened 8 months ago

thevaibhavkute commented 8 months ago

Hey, Thank you for the wonder3d_mesh_kaggle notebook. It is working fine on owl.png I just tested.

How to test on our custom image?

Thank you

git2andi commented 8 months ago

So for Colab I have done this

from google.colab import files

uploaded = files.upload()
print("Manually move it to /content/example_images")

Then, I selected the custom image (with no background) and moved it into the example_images folder. In Kaggle you should upload the file manually I guess, rest should be the same.

Next, "enhance" the image as follows (this is optional)

from PIL import Image, ImageEnhance

image_path = "/content/Wonder3D/example_images/NameOfUploadedImage.png" #change name if required
image = Image.open(image_path)
sharpness = ImageEnhance.Sharpness(image)
image = sharpness.enhance(2.0)
image.save("/content/Wonder3D/example_images/NameOfEnhancedImage.png") #change name if required
print("Manually update image path in/content/Wonder3D/configs/mvdiffusion-joint-ortho-6views.yaml")

Open /content/Wonder3D/configs/mvdiffusion-joint-ortho-6views.yaml and change 'filepaths: ['NameOfEnhancedImage.png'] and save it

run the first command as given:

%cd /content/Wonder3D
!accelerate launch --config_file 1gpu.yaml test_mvdiffusion_seq.py --config /content/Wonder3D/configs/mvdiffusion-joint-ortho-6views.yaml

when this is done, change the dataset.scene=XXX in the second given command. XXX is the last directory name of /content/Wonder3D/outputs/cropsize-192-cfg3.0/XXX depending on the name of the uploaded image

%cd /content/Wonder3D/instant-nsr-pl
!python launch.py --config configs/neuralangelo-ortho-wmask.yaml --gpu 0 --train dataset.root_dir=/content/Wonder3D/outputs/cropsize-192-cfg3.0 dataset.scene=XXX

Additionally (also optional) increase the max_steps in /content/Wonder3D/instant-nsr-pl/configs/neuralangelo-ortho-wmask.yaml for better results (at least I think so :D) As mentioned this is done in Colab, but I assume Kaggle works the same. Just remember to change the start of all Paths to /kaggle/working/ as /content/ is typical for Colab. Hope this helped.