전체 글 49

MAT: generate_image.py

해당 파일은 MAT 논문의 테스트 코드인 generate_image.py이다. 한 줄씩 꼼꼼히 공부하며 해당 코드가 어떻게 동작하는지 주석으로 설명하였다. # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software ..

코드 분석/MAT 2023.12.26

데이터 전처리와 관련된 유용한 함수들

이미지 파일을 불러와 넘파이 배열로 만들어주는 함수 def read_image(image_path): # 이미지 파일을 바이트로 읽어옵니다. with open(image_path, 'rb') as f: # 텍스트 파일이 아니므로 rb, 즉 이진 코드로 읽어온다. # 만약 이미지가 PNG 형식이고, pyspng 라이브러리가 설치되어 있다면 if pyspng is not None and image_path.endswith('.png'): # pyspng를 사용하여 PNG 이미지를 읽어옵니다. image = pyspng.load(f.read()) else: # 그 외의 경우에는 PIL 라이브러리를 사용하여 이미지를 NumPy 배열로 읽어옵니다. image = np.array(PIL.Image.open(f)) ..

MAT: Mask-Aware Transformer for Large Hole Image Inpainting

convolutional head input data: incompleted image Im and given mask M to extract tokens one: change the input dimension three: down sample the resolution(1/8 size) numbers of convolution channels and FC dimensions to 180 for the head, body, and reconstruction modules. reason of this module 1. it is designed for fast downsampling to reduce computational complexity and memory cost. 2. empirically f..

모델 가중치 초기화

torch.nn.init.uniform_ 등으로 각 레이어별 웨이트를 초기화할 수 있다. import torch import torch.nn as nn import torch.nn.functional as F layer = torch.nn.Conv2d(1, 1, 2) # 간단한 예시 레이어 print(layer, end = '\n\n') print(layer.__class__.__name__, end = '\n\n') #객체 이름 출력 print(dir(layer), end = '\n\n') # 객체 어트리뷰트 모두 출력 print(hasattr(layer, 'weight'), end = '\n\n') #객체 어트리뷰트 중 'weight'라는 것이 있는가? print(layer.weight, end = ..

make_dataset 함수

import os from PIL import Image IMG_EXTENSIONS = ['.jpg', '.JPG', '.jpeg', '.JPEG', '.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP', '.tif', '.TIF', '.tiff', '.TIFF',] def is_image_file(filename): return any(filename.endswith(extension) for extension in IMG_EXTENSIONS) # 주어진 파일 이름이 이미지 파일인지 여부를 확인하는 함수입니다. # 파일 이름이 IMG_EXTENSIONS에 정의된 확장자 중 하나로 끝나면 True를 반환하고, 그렇지 않으면 False를 반환합니다. def make_datas..

An Efficient Non-Negative Matrix-Factorization-Based Approach to Collaborative Filtering for Recommender Systems

본 논문은 추천 시스템에서 Matrix Factorzation을 이용한 Collaborative Filtering 기술을 한 단계 더 진보시켰다. 해당 논문을 읽으면서 필기한 내용을 정리한다. 논문 링크: https://ieeexplore.ieee.org/abstract/document/6748996 An Efficient Non-Negative Matrix-Factorization-Based Approach to Collaborative Filtering for Recommender Systems Matrix-factorization (MF)-based approaches prove to be highly accurate and scalable in addressing collaborative filt..