nerfstudio-project / nerfstudio

A collaboration friendly studio for NeRFs
https://docs.nerf.studio
Apache License 2.0
9.26k stars 1.25k forks source link

How to make the background transparent #2574

Open tree8888 opened 10 months ago

tree8888 commented 10 months ago

Although many issues have proposed methods to make the background transparent, such as adding a mask or using the command - pipeline. model. background_ Color 'random', but I didn't see any specific guidelines telling me exactly what to do.

I already know that the mask has a black and white single channel form. If I add a mask Path, 1. How to downscale the masks folder to match images 2,Images 4, images 8 folders (I saw someone using ns-process-data, but I don't know the specific command)? 2. Do I need to manually add mask_paths for each image in the transforms.json file? If there are hundreds of images, this job looks very cumbersome. Is there any convenient method to do this?

If using commands alone, does it mean that there is no need to add mask_path? Does that mean that the background in the images folder should initially be transparent? Following this thinking, I tried this method and the output looked very bad. I was wondering if I missed any key points. image

If someone could guide me, I would be very grateful. I have just started learning to use nerfstudio, and I have read many issues, but I can't understand them.😥

If someone could provide me with your background transparent model dataset to help me better understand the composition of the dataset, I would be very, very grateful.😊

my mind is a bit confused. If there is any mistake in my thinking, please correct me.🥰

biyuefeng commented 9 months ago

You can use other models to obtain mask images, and then combine them with RGB images to form a 4-channel transparent image with only the target object. However, nerfstudio does not support 4-channel image input, how should the source code be modified?

hoanhle commented 1 month ago

@tree8888 Can you tried with https://github.com/nerfstudio-project/nerfstudio/pull/2165 first?

note: ns-train nerfacto --pipeline.model.background_color "random" should be enough. example data can be e.g: the lego dataset. (rgba images, no need for the mask_path in transforms.json for now)