godx7's picture
Upload folder using huggingface_hub
3805eff verified
Raw
History Blame Contribute Delete
418 Bytes
import numpy as np
from PIL import Image
from .sam2 import SAM2Config, VQ_SAM2, VQ_SAM2Config
class DirectResize:
def __init__(self, target_length: int) -> None:
self.target_length = target_length
def apply_image(self, image: np.ndarray) -> np.ndarray:
img = Image.fromarray(image.astype(np.uint8), mode="RGB")
return np.array(img.resize((self.target_length, self.target_length)))