This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import warnings | |
import PIL | |
from PIL import Image | |
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple | |
import torch | |
import argparse | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import random | |
def get_resize_shape(H, W, length=720): | |
if H > W and H > length: | |
new_H, new_W = length, int(W / H * length) | |
elif W > H and W > length: | |
new_H, new_W = int(H / W * length), length | |
else: | |
new_H, new_W = H, W |