Skip to content

Commit

Permalink
upcasing imagenet normalization masks' constants
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmednasserswe committed Jan 29, 2024
1 parent 3918aa0 commit 1a7b01b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/model/image_sscd.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from PIL import Image
import urllib.request

imagenet_normalization_mean = [0.485, 0.456, 0.406]
imagenet_normalization_std = [0.229, 0.224, 0.225]
IMAGENET_NORMALIZATION_MEAN = [0.485, 0.456, 0.406]
IMAGENET_NORMALIZATION_STD = [0.229, 0.224, 0.225]
class Model(Model):
def __init__(self):
super().__init__()
Expand All @@ -35,7 +35,7 @@ def compute_sscd(self, iobytes: io.BytesIO) -> str:
# from SSCD-copy-detection readme https://github.com/facebookresearch/sscd-copy-detection/tree/main#preprocessing
# Normalization using the mean and std of Imagenet
normalize = transforms.Normalize(
mean = imagenet_normalization_mean , std = imagenet_normalization_std,
mean = IMAGENET_NORMALIZATION_MEAN , std = IMAGENET_NORMALIZATION_STD,
)
# It is recommended by publishers of SSCD-copy-detection to preprocess images for inference either resizing the small edge to 288 or resizing the image to a square tensor.
# resizing the image to a square tensor is more effecient on gpus but can lead to skewed images and so loss of information. So, we are resizing the small edge to 288
Expand Down

0 comments on commit 1a7b01b

Please sign in to comment.