기술/Computer Vision

    self-supervised learning

    http://dmqm.korea.ac.kr/activity/seminar/302 고려대학교 DMQA 연구실 고려대학교 산업경영공학부 데이터마이닝 및 품질애널리틱스 연구실 dmqa.korea.ac.kr

    conv1d, conv2d, conv3d

    https://pytorch.org/docs/stable/generated/torch.nn.Conv1d.html#torch.nn.Conv1d Conv1d — PyTorch 1.10.0 documentation Shortcuts pytorch.org https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html#torch.nn.Conv2d Conv2d — PyTorch 1.10.0 documentation Shortcuts pytorch.org https://pytorch.org/docs/stable/generated/torch.nn.Conv3d.html Conv3d — PyTorch 1.10.0 documentation Shortcuts pytorch.o..

    랜덤 샘플 이미지

    @torch.no_grad() def inference(weight, name, img): if img is None: img = np.random.randint(0, 255, size=(112, 112, 3), dtype=np.uint8) else: img = cv2.imread(img) img = cv2.resize(img, (112, 112)) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = np.transpose(img, (2, 0, 1)) img = torch.from_numpy(img).unsqueeze(0).float() img.div_(255).sub_(0.5).div_(0.5) net = get_model(name, fp16=False) net.lo..

    image normalize, inverse normalize

    normalize는 torchvision의 transforms를 쓰든, albumentations를 사용하든 하면 되고, 중요한건 안에 Normalize로 주는 means, std 매개변수들만 바꿔주면 됨. import albumentations as A from albumentations.pytorch import ToTensorV2 from torchvision import transforms self.transform = A.Compose([ A.Normalize(mean=(0.548, 0.504, 0.479), std=(0.237, 0.247, 0.246)), ToTensorV2(), ]) invTrans = transforms.Compose([transforms.Normalize(mean=[0...

    tensor image to numpy image, numpy image to tensor image

    여기서 말하는 tensor는 pytorch tensor임. 변환방법 1. 바닐라 방법(제일 좋은듯) def image_tensor_to_numpy(tensor_image): # If this is already a numpy image, just return it if type(tensor_image) == np.ndarray: return tensor_image # Make sure this is a tensor and not a variable if type(tensor_image) == Variable: tensor_image = tensor_image.data # Convert to numpy and move to CPU if necessary np_img = tensor_image.detach(..

    컴퓨터비전 방법론들

    https://dacon.io/competitions/official/235746/overview/description 카메라 이미지 품질 향상 AI 경진대회 - DACON dacon.io 이 대회 베이스라인 코드들을 분석했지만 정작 다른것들 하느라 시간이 없어 분석만 하고 못써먹었다. 그래서 가만히 두면 잊어버릴것 같고 그러기엔 유용해서 적어둠. 중구난방으로 쓸 거라 나중에 다른 글로 분리해야 할 수도 있다. 1. albumentations 라이브러리로 label image도 augment https://dacon.io/competitions/official/235746/codeshare/2909?page=2&dtype=recent from torch.utils.data import Dataset fr..