ZhengPeng7 commited on
Commit
440356f
β€’
1 Parent(s): 7afa5a1

Remove unnecessary weights.

Browse files
app.py CHANGED
@@ -41,7 +41,7 @@ class ImagePreprocessor():
41
 
42
 
43
  model = BiRefNet(bb_pretrained=False)
44
- state_dict = ['./BiRefNet-DIS-epoch_590.pth', 'BiRefNet-massive-epoch_240.pth', 'BiRefNet-portrait-TR_P3M_10k-epoch_120.pth'][1]
45
  if os.path.exists(state_dict):
46
  birefnet_dict = torch.load(state_dict, map_location="cpu")
47
  unwanted_prefix = '_orig_mod.'
@@ -81,7 +81,7 @@ def predict(image, resolution):
81
  for image, pred in zip(images, preds):
82
  image = image.resize(pred.shape[::-1])
83
  pred = np.repeat(np.expand_dims(pred, axis=-1), 3, axis=-1)
84
- image_preds.append(((pred>0.5) * image).astype(np.uint8))
85
 
86
  return image, image_preds[0]
87
 
 
41
 
42
 
43
  model = BiRefNet(bb_pretrained=False)
44
+ state_dict = ['BiRefNet-massive-epoch_240.pth'][0]
45
  if os.path.exists(state_dict):
46
  birefnet_dict = torch.load(state_dict, map_location="cpu")
47
  unwanted_prefix = '_orig_mod.'
 
81
  for image, pred in zip(images, preds):
82
  image = image.resize(pred.shape[::-1])
83
  pred = np.repeat(np.expand_dims(pred, axis=-1), 3, axis=-1)
84
+ image_preds.append((pred * image).astype(np.uint8))
85
 
86
  return image, image_preds[0]
87
 
BiRefNet-DIS-epoch_590.pth β†’ materials/examples/1#Accessories#5#Jewelry#12836147075_09291d1d24_o.jpg RENAMED
File without changes
BiRefNet-portrait-TR_P3M_10k-epoch_120.pth β†’ materials/examples/20#Sports#8#Racket#4827171149_3140bffe12_o.jpg RENAMED
File without changes
materials/examples/4#Architecture#3#Crack#3551574032_17dd106d31_o.jpg ADDED

Git LFS Details

  • SHA256: 0e899558af9864917bf753bfa121142e14f37d05603c249fe54b929dbfa8911a
  • Pointer size: 131 Bytes
  • Size of remote file: 796 kB