|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
prompts=() |
|
|
asset_types=() |
|
|
output_root="" |
|
|
seed=0 |
|
|
|
|
|
|
|
|
while [[ $# -gt 0 ]]; do |
|
|
case "$1" in |
|
|
--prompts) |
|
|
shift |
|
|
while [[ $# -gt 0 && ! "$1" =~ ^-- ]]; do |
|
|
prompts+=("$1") |
|
|
shift |
|
|
done |
|
|
;; |
|
|
--asset_types) |
|
|
shift |
|
|
while [[ $# -gt 0 && ! "$1" =~ ^-- ]]; do |
|
|
asset_types+=("$1") |
|
|
shift |
|
|
done |
|
|
;; |
|
|
--output_root) |
|
|
output_root="$2" |
|
|
shift 2 |
|
|
;; |
|
|
--seed) |
|
|
seed="$2" |
|
|
shift 2 |
|
|
;; |
|
|
*) |
|
|
echo "Unknown argument: $1" |
|
|
exit 1 |
|
|
;; |
|
|
esac |
|
|
done |
|
|
|
|
|
|
|
|
if [[ ${#prompts[@]} -eq 0 || -z "$output_root" ]]; then |
|
|
echo "Missing required arguments." |
|
|
echo "Usage: bash run_text2asset3d.sh --prompts \"Prompt1\" \"Prompt2\" \ |
|
|
--asset_types \"type1\" \"type2\" --seed <seed_value> --output_root <path>" |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
|
|
|
if [[ ${#asset_types[@]} -eq 0 ]]; then |
|
|
for (( i=0; i<${#prompts[@]}; i++ )); do |
|
|
asset_types+=("") |
|
|
done |
|
|
fi |
|
|
|
|
|
|
|
|
if [[ ${#prompts[@]} -ne ${#asset_types[@]} ]]; then |
|
|
echo "The number of asset types must match the number of prompts." |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
|
|
|
echo "Prompts:" |
|
|
for p in "${prompts[@]}"; do |
|
|
echo " - $p" |
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Output root: ${output_root}" |
|
|
echo "Seed: ${seed}" |
|
|
|
|
|
|
|
|
prompt_args="" |
|
|
asset_type_args="" |
|
|
for i in "${!prompts[@]}"; do |
|
|
prompt_args+="\"${prompts[$i]}\" " |
|
|
asset_type_args+="\"${asset_types[$i]}\" " |
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
echo ${prompt_args} |
|
|
eval python3 embodied_gen/scripts/text2image.py \ |
|
|
--prompts ${prompt_args} \ |
|
|
--output_root "${output_root}/images" \ |
|
|
--seed ${seed} |
|
|
|
|
|
|
|
|
python3 embodied_gen/scripts/imageto3d.py \ |
|
|
--image_root "${output_root}/images" \ |
|
|
--output_root "${output_root}/asset3d" \ |
|
|
--asset_type ${asset_type_args} |
|
|
|