Regarding the issue we faced while running inference with your code..

#8
by johnsathya - opened

When I upload images in Spaces, the background removal works correctly. However, when I run the same process from the code level, it doesn't work correctly for some images. Could you please provide us with the updated code that is correctly working in Spaces?"

Screenshot 2024-08-28 121225.png

Oh I will check this, thanks for reporting

Hello @schirrmacher actually this issue got solved like i have updated the computeloss function which is given below
def compute_loss(self, predictions, ground_truth, ground_truth_edges):
bce_loss = nn.BCELoss(size_average=True)
dice_loss = DiceLoss() # Define a Dice loss class or use one from a library
loss = 0.0
for i in range(len(predictions)):
pred = predictions[i]
loss += bce_loss(pred, ground_truth) + dice_loss(pred, ground_truth)
if i == 0:
primary_loss = loss
# Edge-aware component (assuming you have edge annotations)
if ground_truth_edges is not None:
edge_loss = EdgeAwareLoss()(pred, ground_truth_edges) # Define this class
loss += edge_loss
return primary_loss, loss

But im facing another issue like you can able see some feather in the hair
image.png

Sign up or log in to comment