Upload processor
Browse files- image_processing_basnet.py +0 -28
image_processing_basnet.py
CHANGED
|
@@ -239,34 +239,6 @@ class BASNetImageProcessor(BaseImageProcessor):
|
|
| 239 |
dn = (d - mi) / ((ma - mi) + torch.finfo(torch.float32).eps)
|
| 240 |
return dn
|
| 241 |
|
| 242 |
-
# prediction = _norm_output(prediction)
|
| 243 |
-
# prediction = prediction.squeeze()
|
| 244 |
-
# prediction_np = prediction.cpu().numpy()
|
| 245 |
-
|
| 246 |
-
# image = Image.fromarray(prediction_np * 255).convert("RGB")
|
| 247 |
-
# image = image.resize((width, height), resample=Image.Resampling.BILINEAR)
|
| 248 |
-
|
| 249 |
-
# return image
|
| 250 |
-
|
| 251 |
-
# breakpoint()
|
| 252 |
-
|
| 253 |
-
# output = F.interpolate(output, (height, width), mode="bilinear")
|
| 254 |
-
# output = output.squeeze(dim=0)
|
| 255 |
-
|
| 256 |
-
# output = _norm_output(output)
|
| 257 |
-
|
| 258 |
-
# # Add 0.5 after unnormalizing to [0, 255] to round to nearest integer
|
| 259 |
-
# output = output * 255 + 0.5
|
| 260 |
-
# output = output.clamp(0, 255)
|
| 261 |
-
|
| 262 |
-
# # shape: (C=1, W, H) -> (W, H, C=1)
|
| 263 |
-
# output = output.permute(1, 2, 0)
|
| 264 |
-
# # shape: (W, H, C=3)
|
| 265 |
-
# output = output.repeat(1, 1, 3)
|
| 266 |
-
|
| 267 |
-
# output_np = output.cpu().numpy().astype(np.uint8)
|
| 268 |
-
# return Image.fromarray(output_np)
|
| 269 |
-
|
| 270 |
prediction = _norm_prediction(prediction)
|
| 271 |
prediction = prediction.squeeze()
|
| 272 |
prediction = prediction * 255 + 0.5
|
|
|
|
| 239 |
dn = (d - mi) / ((ma - mi) + torch.finfo(torch.float32).eps)
|
| 240 |
return dn
|
| 241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
prediction = _norm_prediction(prediction)
|
| 243 |
prediction = prediction.squeeze()
|
| 244 |
prediction = prediction * 255 + 0.5
|