Files

128 lines
5.2 KiB
Markdown
Raw Permalink Normal View History

2025-07-01 01:53:12 +00:00
2025-07-04 11:39:43 +08:00
# Design2GarmentCode: Turning Design Concepts to Tangible Garments Through Program Synthesis
2025-07-01 01:53:12 +00:00
2025-07-04 11:39:43 +08:00
[![arXiv](https://img.shields.io/badge/📃-arXiv%20-red.svg)](https://arxiv.org/abs/2412.08603)
[![webpage](https://img.shields.io/badge/🌐-Website%20-blue.svg)](https://style3d.github.io/design2garmentcode/)
[![Youtube](https://img.shields.io/badge/📽️-Video%20-orchid.svg)](https://www.youtube.com/xxx)
2025-07-01 01:53:12 +00:00
2025-07-04 11:39:43 +08:00
<span class="author-block"><a href="">Feng Zhou</a>,&nbsp;</span>
<span class="author-block"><a href="https://walnut-ree.github.io/">Ruiyang Liu</a>,&nbsp;</span>
<span class="author-block"><a href="">Chen Liu</a>,&nbsp;</span>
<span class="author-block"><a href="">Gaofeng He</a>,&nbsp;</span>
<span class="author-block"><a href="https://dirtyharrylyl.github.io/">Yong-Lu Li</a>,&nbsp;</span>
<span class="author-block"><a href="http://www.cad.zju.edu.cn/home/jin/">Xiaogang Jin</a>,&nbsp;</span>
<span class="author-block"><a href="https://wanghmin.github.io/">Huamin Wang</a></span>
<p align="center">
2025-07-04 13:08:38 +08:00
<img src="https://github.com/Style3D/design2garmentcode-impl/raw/main/assets/img/neural_symbolic-pipeline.png">
2025-07-04 11:39:43 +08:00
</p>
Official implementation for Design2GarmentCode, a motility-agnostic sewing pattern generation framework that leverages fine-tuned Large Multimodal Models to generate parametric pattern-making programs from multi-modal design concepts.
2025-07-01 01:53:12 +00:00
2025-07-03 17:03:00 +08:00
## Installation
### 1. Clone the repository
```bash
2025-07-04 18:40:18 +08:00
git clone https://github.com/Style3D/design2garmentcode-impl.git
2025-07-04 18:38:43 +08:00
cd design2garmentcode-impl
2025-07-03 17:03:00 +08:00
```
2025-07-01 01:53:12 +00:00
2025-07-03 17:03:00 +08:00
### 2. Create the Conda environment
An `environment.yml` file is provided in the project root with all required Conda and PyPI dependencies (Python 3.9.19, Torch 2.4.0 + CUDA 12.1, etc.).
2025-07-01 01:53:12 +00:00
2025-07-03 17:03:00 +08:00
```bash
conda env create -f environment.yml
conda activate d2g
python -m pip install --upgrade pip # optional: upgrade pip
```
2025-07-01 01:53:12 +00:00
2025-07-03 17:03:00 +08:00
### 3. (Optional) Enable 3D simulation
If you need local cloth simulation and 3D visualization, follow the installation instructions for **GarmentCode Warp Simulator**:
<https://github.com/maria-korosteleva/NvidiaWarp-GarmentCode>
---
### 4. LanguageModel API
`Design2GarmentCode` communicates with large multimodal models.
Follow the steps **in the given order**:
2025-07-04 13:20:19 +08:00
#### 1. **Provide API credentials for MMUA**
- **Environment variable (recommended)** defaults to *ChatGPT4o*
2025-07-03 17:03:00 +08:00
```bash
export OPENAI_API_KEY="sk..."
```
2025-07-04 13:20:19 +08:00
- **Edit `system.json`** (project root) manually specify `api_key`, `base_url`, and `model` if you prefer a filebased approach.
#### 2. **Set up the parameter projector**:
- Download the base model [Qwen2-VL-2B-Instruct](https://huggingface.co/Qwen/Qwen2-VL-2B-Instruct/tree/main) and place the modal to `lmm_utils/Qwen/Qwen2-VL-2B-Instruct/`.
2025-07-04 14:18:25 +08:00
- Download the fine-tuned weights file from [Google Drive](https://drive.google.com/file/d/1CL7OLUq6fYcwoDuLRkBxtKNxJ0_G73U-/view?usp=sharing), and place it in `lmm_utils/Qwen/qwen2vl_lora_mlp/`.
2025-07-03 17:03:00 +08:00
---
2025-07-04 11:39:43 +08:00
## Testing with GUI
Setting up the GUI with `python gui.py` where you will see the following interface (modified from GarmentCode)
<p align="center">
2025-07-04 13:08:38 +08:00
<img src="https://github.com/Style3D/design2garmentcode-impl/raw/main/assets/img/gui_example.png">
2025-07-04 11:39:43 +08:00
</p>
2025-07-04 13:08:38 +08:00
Switching to the `PARSE DESIGN` tab, and input your design input, either text description, photograph or sketch, to the chatbox. The generated sewing pattern will appear on the right side after parsing.
2025-07-04 11:39:43 +08:00
Once a pattern is generated, you can modify the result by typing `modify: <your-instruction>` in the chatbox.
2025-07-03 17:03:00 +08:00
---
2025-07-04 11:39:43 +08:00
## Batch Inference
2025-07-03 17:03:00 +08:00
### 1. Text Guided Generation
Use `test_text_batch.py` to process a list of text descriptions from a JSON file.
```bash
python lmm_utils/test_text_batch.py \
--input assets/test_text/examples.json \
--output assets/test_text_result \
--sim
2025-07-01 01:53:12 +00:00
```
2025-07-03 17:03:00 +08:00
- `--input`: Path to your input JSON file containing multiple garment description texts.
- `--output`: Directory where the output `.json` files will be saved.
- `--sim`: Enable or disable physical simulation output.
Supports physical simulation (enabled by default in script).
2025-07-01 01:53:12 +00:00
2025-07-03 17:03:00 +08:00
---
2025-07-01 01:53:12 +00:00
2025-07-03 17:03:00 +08:00
### 2. Image Guided Generation
2025-07-01 01:53:12 +00:00
2025-07-03 17:03:00 +08:00
Use `test_picture_batch.py` to process all image files in a directory.
2025-07-01 01:53:12 +00:00
2025-07-03 17:03:00 +08:00
```bash
python lmm_utils/test_picture_batch.py \
--input assets/test_img/examples \
--output assets/test_image_result/examples \
--sim
```
- `--input`: Folder containing multiple image files.
- `--output`: Output folder where results will be saved.
- `--sim`: Enable or disable physical simulation output.
2025-07-01 01:53:12 +00:00
2025-07-03 17:03:00 +08:00
---
2025-07-01 01:53:12 +00:00
2025-07-04 11:39:43 +08:00
## Simulate 3D Garment
2025-07-03 17:03:00 +08:00
### 1. Generate from a pattern.json
2025-07-04 11:39:43 +08:00
After generating the pattern data, you can simulate the corresponding 3D output directly from the pattern's JSON file with
2025-07-03 17:03:00 +08:00
```bash
2025-07-03 17:16:01 +08:00
python test_garment_sim.py --pattern_spec $INPUT_JSON
2025-07-03 17:03:00 +08:00
```
2025-07-04 11:39:43 +08:00
Or run the simulation directly in the `3D View` GUI tab.
2025-07-03 17:03:00 +08:00
### Citation
If you find this work useful, please cite:
```bibtex
2025-11-19 10:15:29 +08:00
@inproceedings{zhou2025design2garmentcode,
2025-07-03 17:03:00 +08:00
title={Design2GarmentCode: Turning Design Concepts to Tangible Garments Through Program Synthesis},
author={Zhou, Feng and Liu, Ruiyang and Liu, Chen and He, Gaofeng and Li, Yong-Lu and Jin, Xiaogang and Wang, Huamin},
2025-07-04 11:39:43 +08:00
booktitle={Proceedings of the Computer Vision and Pattern Recognition Conference},
2025-11-19 10:15:29 +08:00
pages={23712--23722},
2025-07-04 11:39:43 +08:00
year={2025}
2025-07-03 17:03:00 +08:00
}
2025-11-19 10:13:55 +08:00
```