Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
quattrinifabio committed Aug 8, 2024
1 parent 1ab3eb0 commit 102d6ea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pip install -r requirements.txt

```python
python generate_prompt.py --setting centering-rgba-alfie --fg_prompt 'A photo of a cat with a hat'
python generate_prompt.py --setting centering-rgba-alfie --fg_prompt 'A large, colorful tree made of money, with lots of yellow and white coins hanging from its branches'

```

Expand Down
1 change: 1 addition & 0 deletions alfie/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def get_pipe(image_size, scheduler, device):
def base_arg_parser():
parser = argparse.ArgumentParser()
parser.add_argument("--centering", type=str, default='True')
parser.add_argument("--k", type=int, default=1)
parser.add_argument("--resample", type=str, default='True')
parser.add_argument("--scheduler", type=str, default='euler', choices=['euler', 'euler_ancestral'])
parser.add_argument("--use_neg_prompt", type=str, default='True')
Expand Down
4 changes: 3 additions & 1 deletion generate_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ def main():
alfie_rgba_image_filename = Path(args.save_folder / f"{name}-rgba-alfie.png")
alfie_rgba_image_filename.parent.mkdir(parents=True, exist_ok=True)
alpha_mask_alfie = torch.tensor(alpha_mask)
alpha_mask_alfie = torch.where(alpha_mask_alfie == 1, normalize_masks(heatmaps['ff_heatmap'] + 1 * heatmaps['cross_heatmap_fg']), 0.)
alfa_hat = normalize_masks(heatmaps['ff_heatmap'] + 1 * heatmaps['cross_heatmap_fg'])
alfa_hat = (alfa_hat + args.k * alfa_hat).clip(0, 1)
alpha_mask_alfie = torch.where(alpha_mask_alfie == 1, alfa_hat, 0.)
save_rgba(image, alpha_mask_alfie, alfie_rgba_image_filename)

elif args.cutout_model == 'vit-matte':
Expand Down

0 comments on commit 102d6ea

Please sign in to comment.