From 87ff24dbd435dfafd45111f87f3957745039d694 Mon Sep 17 00:00:00 2001 From: Xinjie Date: Tue, 22 Jul 2025 00:27:06 +0800 Subject: [PATCH] chore(pipe): Update image-to-3d model loading position. (#26) Update image-to-3d model loading position. --------- Co-authored-by: xinjie.wang --- embodied_gen/scripts/imageto3d.py | 32 ++++++++++++++----------------- install/install_extra.sh | 17 ---------------- 2 files changed, 14 insertions(+), 35 deletions(-) diff --git a/embodied_gen/scripts/imageto3d.py b/embodied_gen/scripts/imageto3d.py index f36cfa8..fd89f6e 100644 --- a/embodied_gen/scripts/imageto3d.py +++ b/embodied_gen/scripts/imageto3d.py @@ -30,11 +30,7 @@ from embodied_gen.data.backproject_v2 import entrypoint as backproject_api from embodied_gen.data.utils import delete_dir, trellis_preprocess from embodied_gen.models.delight_model import DelightingModel from embodied_gen.models.gs_model import GaussianOperator -from embodied_gen.models.segment_model import ( - BMGG14Remover, - RembgRemover, - SAMPredictor, -) +from embodied_gen.models.segment_model import RembgRemover from embodied_gen.models.sr_model import ImageRealESRGAN from embodied_gen.scripts.render_gs import entrypoint as render_gs_api from embodied_gen.utils.gpt_clients import GPT_CLIENT @@ -62,6 +58,19 @@ os.environ["GRADIO_ANALYTICS_ENABLED"] = "false" os.environ["SPCONV_ALGO"] = "native" random.seed(0) +logger.info("Loading Models...") +DELIGHT = DelightingModel() +IMAGESR_MODEL = ImageRealESRGAN(outscale=4) +RBG_REMOVER = RembgRemover() +PIPELINE = TrellisImageTo3DPipeline.from_pretrained( + "microsoft/TRELLIS-image-large" +) +# PIPELINE.cuda() +SEG_CHECKER = ImageSegChecker(GPT_CLIENT) +GEO_CHECKER = MeshGeoChecker(GPT_CLIENT) +AESTHETIC_CHECKER = ImageAestheticChecker() +CHECKERS = [GEO_CHECKER, SEG_CHECKER, AESTHETIC_CHECKER] + def parse_args(): parser = argparse.ArgumentParser(description="Image to 3D pipeline args.") @@ -109,19 +118,6 @@ def entrypoint(**kwargs): if hasattr(args, k) and v is not None: setattr(args, k, v) - logger.info("Loading Models...") - DELIGHT = DelightingModel() - IMAGESR_MODEL = ImageRealESRGAN(outscale=4) - RBG_REMOVER = RembgRemover() - PIPELINE = TrellisImageTo3DPipeline.from_pretrained( - "microsoft/TRELLIS-image-large" - ) - # PIPELINE.cuda() - SEG_CHECKER = ImageSegChecker(GPT_CLIENT) - GEO_CHECKER = MeshGeoChecker(GPT_CLIENT) - AESTHETIC_CHECKER = ImageAestheticChecker() - CHECKERS = [GEO_CHECKER, SEG_CHECKER, AESTHETIC_CHECKER] - assert ( args.image_path or args.image_root ), "Please provide either --image_path or --image_root." diff --git a/install/install_extra.sh b/install/install_extra.sh index 1af2dd3..024f030 100644 --- a/install/install_extra.sh +++ b/install/install_extra.sh @@ -3,23 +3,6 @@ set -e SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) source "$SCRIPT_DIR/_utils.sh" -# try_install "Installing txt2panoimg..." \ -# "pip install txt2panoimg@git+https://github.com/HochCC/SD-T2I-360PanoImage --no-deps" \ -# "txt2panoimg installation failed." - -# try_install "Installing fused-ssim..." \ -# "pip install fused-ssim@git+https://github.com/rahul-goel/fused-ssim#egg=328dc98" \ -# "fused-ssim installation failed." - -# try_install "Installing tiny-cuda-nn..." \ -# "pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch" \ -# "tiny-cuda-nn installation failed." - -# try_install "Installing pytorch3d" \ -# "pip install git+https://github.com/facebookresearch/pytorch3d.git@v0.7.7" \ -# "pytorch3d installation failed." - - PYTHON_PACKAGES_NODEPS=( timm txt2panoimg@git+https://github.com/HochCC/SD-T2I-360PanoImage