Spaces:
Runtime error
Runtime error
jwyang
commited on
Commit
•
5a189a4
1
Parent(s):
6fb88a6
remove pil_interp
Browse files- focalnet.py +4 -5
focalnet.py
CHANGED
@@ -15,7 +15,6 @@ from timm.models.registry import register_model
|
|
15 |
from torchvision import transforms
|
16 |
from timm.data.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
|
17 |
from timm.data import create_transform
|
18 |
-
from timm.data.transforms import _pil_interp
|
19 |
|
20 |
class Mlp(nn.Module):
|
21 |
def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
|
@@ -499,14 +498,14 @@ def build_transforms(img_size, center_crop=False):
|
|
499 |
if center_crop:
|
500 |
size = int((256 / 224) * img_size)
|
501 |
t.append(
|
502 |
-
transforms.Resize(size
|
503 |
)
|
504 |
t.append(
|
505 |
transforms.CenterCrop(img_size)
|
506 |
)
|
507 |
else:
|
508 |
t.append(
|
509 |
-
transforms.Resize(img_size
|
510 |
)
|
511 |
t.append(transforms.ToTensor())
|
512 |
t.append(transforms.Normalize(IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD))
|
@@ -517,14 +516,14 @@ def build_transforms4display(img_size, center_crop=False):
|
|
517 |
if center_crop:
|
518 |
size = int((256 / 224) * img_size)
|
519 |
t.append(
|
520 |
-
transforms.Resize(size
|
521 |
)
|
522 |
t.append(
|
523 |
transforms.CenterCrop(img_size)
|
524 |
)
|
525 |
else:
|
526 |
t.append(
|
527 |
-
transforms.Resize(img_size
|
528 |
)
|
529 |
t.append(transforms.ToTensor())
|
530 |
return transforms.Compose(t)
|
|
|
15 |
from torchvision import transforms
|
16 |
from timm.data.constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
|
17 |
from timm.data import create_transform
|
|
|
18 |
|
19 |
class Mlp(nn.Module):
|
20 |
def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
|
|
|
498 |
if center_crop:
|
499 |
size = int((256 / 224) * img_size)
|
500 |
t.append(
|
501 |
+
transforms.Resize(size)
|
502 |
)
|
503 |
t.append(
|
504 |
transforms.CenterCrop(img_size)
|
505 |
)
|
506 |
else:
|
507 |
t.append(
|
508 |
+
transforms.Resize(img_size)
|
509 |
)
|
510 |
t.append(transforms.ToTensor())
|
511 |
t.append(transforms.Normalize(IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD))
|
|
|
516 |
if center_crop:
|
517 |
size = int((256 / 224) * img_size)
|
518 |
t.append(
|
519 |
+
transforms.Resize(size)
|
520 |
)
|
521 |
t.append(
|
522 |
transforms.CenterCrop(img_size)
|
523 |
)
|
524 |
else:
|
525 |
t.append(
|
526 |
+
transforms.Resize(img_size)
|
527 |
)
|
528 |
t.append(transforms.ToTensor())
|
529 |
return transforms.Compose(t)
|