Skip to content

Commit

Permalink
fix run_drc
Browse files Browse the repository at this point in the history
  • Loading branch information
caradryanl committed May 14, 2024
1 parent 70ad374 commit 03c38e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions diffusers/scripts/run_dino_drc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import colorsys
import requests
from io import BytesIO
import tqdm

import skimage.io
from skimage.measure import find_contours
Expand Down Expand Up @@ -152,7 +153,7 @@ def display_instances(image, mask, fname="test", figsize=(5, 5), blur=False, con
print("There is no reference weights available for this model => We use random weights.")

# open image
for img_name in os.listdir(args.image_path):
for img_name in tqdm.tqdm(os.listdir(args.image_path)):
img_path = os.path.join(args.image_path, img_name)
if os.path.isfile(img_path):
with open(img_path, 'rb') as f:
Expand Down Expand Up @@ -186,7 +187,6 @@ def display_instances(image, mask, fname="test", figsize=(5, 5), blur=False, con
mask = mask[-1]
threshold = np.percentile(mask, args.threshold)
mask = np.where(mask >= threshold, 1, 0)
print(mask.size, mask.sum())
attentions = nn.functional.interpolate(attentions.unsqueeze(0), scale_factor=args.patch_size, mode="nearest")[0].cpu().numpy()

# save attentions heatmaps
Expand Down

0 comments on commit 03c38e9

Please sign in to comment.