nsarafianos / Garment3DGen

Other
58 stars 6 forks source link

text #9

Open githubnameoo opened 1 month ago

githubnameoo commented 1 month ago

How to generate 3D clothing based on text or images, what are the running instructions? text_input, image_input, fashion_image, fashion_text, use_target_mesh = False, False, False, False, True How to set the text and image

nsarafianos commented 1 month ago

If you'd like to solely pass a text-prompt or an image-prompt for guidance (instead of a 3D geometry) then you have 2 main options:

  1. Use CLIP in which case you can choose text_input or image input as True and the rest as false
  2. Use FashionCLIP in which case you can choose fashion_image or fashion_text as True and the rest as False.

Feel free to take a look at each individual functions and they should guide you for next steps!

wjy0501 commented 1 month ago

After changing text_input to True and running it using CLIP, I encountered the following problem:

Traceback (most recent call last):
File "main.py", line 92, in main() File "main.py", line 88, in main loop(cfg) File "/home/jingyiwu/Garment3DGen/loop.py", line 363, in loop deformed_features = fclip.encode_image_tensors(train_render) UnboundLocalError: local variable 'fclip' referenced before assignment nanobind: leaked 1 instances!

After CLIP_embeddings=True, the code did not assign a value to fclip. Can you tell me how to modify text_input=True and CLIP_embedding=True to achieve text generation mesh?

wjy0501 commented 1 month ago

In loop 73, when we set use_target_mesh=false, we are unable to conduct further training text_input, image_input, fashion_image, fashion_text, use_target_mesh = True, False, False, False, False

Traceback (most recent call last): File "main.py", line 92, in main() File "main.py", line 88, in main loop(cfg) File "/home/jingyiwu/Garment3DGen/loop.py", line 365, in loop target_features = fclip.encode_image_tensors(train_target_render) UnboundLocalError: local variable 'train_target_render' referenced before assignment

But I have found that train_target_dender can only be used when use_target is true, in loop 287

    if use_target_mesh:
        final_target_mesh = render_target_mesh.eval(params_camera)
        train_target_render = render.render_mesh(
            glctx,
            final_target_mesh,
            params_camera['mvp'],
            params_camera['campos'],
            params_camera['lightpos'],
            cfg.light_power,
            cfg.train_res,
            spp=1,
            num_layers=1,
            msaa=False,
            background=params_camera['bkgs']
        ).permute(0, 3, 1, 2)
        train_target_render = resize(train_target_render, out_shape=(224, 224), interp_method=resize_method)