Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie Hewitt committed Oct 9, 2024
1 parent 15bf364 commit 13ad590
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
11 changes: 10 additions & 1 deletion DATASETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ datasets and is not directly redistributed by us. This data will be downloaded a
of the `download_data.py` script. You can use `python visualize_data.py [path_to_dataset]` to visualize the data
including some ground-truth annotations.

First setup your environment by running `pip install -r requirements.txt`.
First setup your environment by running `pip install -r requirements.txt` using python 3.10.

## SynthBody

Expand All @@ -21,6 +21,9 @@ The following command will download the dataset to `YOUR_DATA_DIRECTORY/synth_bo
python download_data.py --dataset body --output-dir YOUR_DATA_DIRECTORY/
```

If you want just a small subset of the data you can add the `--sample` flag.
The total size of the dataset is approximately TODOGB.

### Contents

#### Image Data
Expand Down Expand Up @@ -99,6 +102,9 @@ The following command will download the dataset to `YOUR_DATA_DIRECTORY/synth_fa
python download_data.py --dataset face --output-dir /YOUR_DATA_DIRECTORY/
```

If you want just a small subset of the data you can add the `--sample` flag.
The total size of the dataset is approximately TODOGB.

### Contents

#### Image Data
Expand Down Expand Up @@ -172,6 +178,9 @@ The following command will download the dataset to `YOUR_DATA_DIRECTORY/synth_ha
python download_data.py --dataset hand --output-dir /YOUR_DATA_DIRECTORY/
```

If you want just a small subset of the data you can add the `--sample` flag.
The total size of the dataset is approximately TODOGB.

### Contents

#### Image Data
Expand Down
27 changes: 13 additions & 14 deletions download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def _download_mpii_file(username: str, password: str, domain: str, file: str, ou
def get_mano(out_dir: Path) -> None:
"""Download MANO data."""
print("Downloading MANO...")
username = input("Username: ")
password = getpass("Password: ")
username = input("Username for https://mano.is.tue.mpg.de/: ")
password = getpass("Password for https://mano.is.tue.mpg.de/: ")
_download_mpii_file(
username,
password,
Expand All @@ -86,8 +86,8 @@ def get_mano(out_dir: Path) -> None:
def get_amass(out_dir: Path) -> None:
"""Download AMASS data."""
print("Downloading AMASS...")
username = input("Username: ")
password = getpass("Password: ")
username = input("Username for https://amass.is.tue.mpg.de/: ")
password = getpass("Password for https://amass.is.tue.mpg.de/: ")
_download_mpii_file(
username,
password,
Expand Down Expand Up @@ -119,11 +119,12 @@ def extract(data_path: Path, out_path: Optional[Path] = None) -> None:
raise ValueError(f"Unknown file type {data_path.suffix}")


def download_synthmocap_data(dataset: str, out_dir: Path) -> None:
def download_synthmocap_data(data_dir: Path, dataset: str, zip_dir: Path, sample: bool) -> None:
"""Download one of the SynthMoCap datasets."""
out_dir.mkdir(exist_ok=True, parents=True)
for part in range(1, N_PARTS + 1):
out_path = out_dir / f"{dataset}_{part:02d}.zip"
data_dir.mkdir(exist_ok=True, parents=True)
zip_dir.mkdir(exist_ok=True, parents=True)
for part in range(1, 2 if sample else N_PARTS + 1):
out_path = zip_dir / f"{dataset}_{part:02d}.zip"
print(f"Downloading {dataset} part {part}...")
url = f"https://facesyntheticspubwedata.blob.core.windows.net/sga-2024-synthmocap/{dataset}_{part:02d}.zip"
try:
Expand All @@ -144,7 +145,8 @@ def download_synthmocap_data(dataset: str, out_dir: Path) -> None:
if out_path.exists():
out_path.unlink()
sys.exit(1)

extract(out_path, data_dir / dataset)
out_path.unlink()

def process_metadata(data_dir: Path, dataset_name: str) -> None:
"""Process the metadata to include the correct pose data."""
Expand Down Expand Up @@ -204,6 +206,7 @@ def main() -> None:
choices=["face", "body", "hand"],
required=True,
)
parser.add_argument("--sample", action="store_true", help="Only download a small sample of the data")
args = parser.parse_args()
dataset_name = f"synth_{args.dataset}"
data_dir = Path(args.output_dir)
Expand All @@ -218,11 +221,7 @@ def main() -> None:
path.unlink()
# download the SynthEgo dataset
zip_dir = data_dir / f"{dataset_name}_zip"
download_synthmocap_data(dataset_name, zip_dir)
# extract the SynthEgo dataset
for path in list(zip_dir.glob("*.zip")):
extract(path, data_dir / dataset_name)
path.unlink()
download_synthmocap_data(data_dir, dataset_name, zip_dir, args.sample)
zip_dir.rmdir()
if args.dataset in ["body", "hand"]:
# process the metadata
Expand Down
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
matplotlib
numpy
opencv-python
pyrender
tqdm
transformations
trimesh
matplotlib==3.7.1
numpy==1.26.4
opencv-python==4.10.0.84
pyrender==0.1.45
tqdm==4.65.0
transformations==2022.9.26
trimesh==3.22.1
4 changes: 2 additions & 2 deletions visualize_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ def draw_landmarks(

def _download_smplh() -> None:
print("Downloading SMPL-H...")
username = input("Username: ")
password = getpass("Password: ")
username = input("Username for https://mano.is.tue.mpg.de/: ")
password = getpass("Password for https://mano.is.tue.mpg.de/: ")
out_path = Path(__file__).parent / "smplh" / "smplh.tar.xz"
out_path.parent.mkdir(exist_ok=True, parents=True)
url = "https://download.is.tue.mpg.de/download.php?domain=mano&resume=1&sfile=smplh.tar.xz"
Expand Down

0 comments on commit 13ad590

Please sign in to comment.