본문 바로가기

전체 글

(528)
InstructPix2Pix: Learning to Follow Image Editing Instructions Project Page InstructPix2Pix We propose a method for editing images from human instructions: given an input image and a written instruction that tells the model what to do, our model follows these instructions to edit the image. To obtain training data for this problem, we combine the www.timothybrooks.com Abstract 언어 모델, text-to-image 확산 모델을 이용해 finetuning, inversion 없이 이미지를 편집하는 InstructPix2Pi..
CompVis/stable-diffusion/main.py 그냥 공부용 정리 import importlib from omegaconf import OmegaConf Json, yaml 등 각종 설정 파일 읽기 및 생성, 변경 작업 지원 from pytorch_lightning import seed_everything from ldm.data.base import Txt2ImgIterableBaseDataset 미리 정의해 둔 데이터셋 형식 class Txt2ImgIterableBaseDataset(IterableDataset): ''' Define an interface to make the IterableDatasets for text2img data chainable ''' def __init__(self, num_records=0, valid_ids=Non..
GLIGEN: Open-Set Grounded Text-to-Image Generation Text2img 확산 모델에서 object 위치, 포즈 지정하기 Project Page GLIGEN:Open-Set Grounded Text-to-Image Generation. Large-scale text-to-image diffusion models have made amazing advances. However, the status quo is to use text input alone, which can impede controllability. In this work, we propose GLIGEN, Grounded-Language-to-Image Generation, a novel approach that build gligen.github.io Abstract Grounding input..
DiffStyler 써보기 DiffStyler 논문 리뷰, DiffStyler 코드 리뷰 이렇게 시간이 오래 걸릴 줄 몰랐는데 원본 코드가 그냥 코드뭉치라 정상적으로 돌아가게 만드는 데 한참이나 걸렸다. 다른 환경에서 돌려보지도 않고 코드를 공개하다니...(물론 공개해 준 것은 고맙지만) 치열한 사투의 흔적... !git clone https://github.com/haha-lisa/Diffstyler !git clone https://github.com/zyxElsa/CAST_pytorch !git clone https://github.com/JunlinHan/DCLGAN %cd /content/Diffstyler !pip install -e ./CLIP !pip install -r requirements.txt import u..
DiffStyler 코드 리뷰 DiffStyler 논문 리뷰, DiffStyler 써보기 Github/DiffStyler GitHub - haha-lisa/Diffstyler: DiffStyler: Controllable Dual Diffusion for Text-Driven Image Stylization DiffStyler: Controllable Dual Diffusion for Text-Driven Image Stylization - GitHub - haha-lisa/Diffstyler: DiffStyler: Controllable Dual Diffusion for Text-Driven Image Stylization github.com 들어가기 전에 main.py 코드가 완전 현대적인? 함수형 프로그래밍이 아니라 함수 내부에..
DiffStyler: Controllable Dual Diffusion for Text-Driven Image Stylization DiffStyler 코드 리뷰, DiffStyler 써보기 Text guided stylization + dual architecture arXiv Github Abstract Text-guided stylization 확산 모델 DiffStyler Dual diffusion architecture를 사용하여 content와 style 사이의 균형을 제어 Content 이미지 기반의 학습 가능한 노이즈로 content의 구조를 보존 (모델을 학습시키는 게 아니라 sampling process의 입력인 학습 가능한 노이즈를 최적화하는 형태임) Introduction 예제 이미지를 이용한 stylization은 content와 style을 분리하는 과정을 거쳐야 하지만 텍스트는 해당 스타일 자체에 대한 의미..
Paint by Example 코드 리뷰 Paint by Example 논문 리뷰, Paint by Example 써보기 Github GitHub - Fantasy-Studio/Paint-by-Example: Paint by Example: Exemplar-based Image Editing with Diffusion Models Paint by Example: Exemplar-based Image Editing with Diffusion Models - GitHub - Fantasy-Studio/Paint-by-Example: Paint by Example: Exemplar-based Image Editing with Diffusion Models github.com 마스크 이미지를 U-Net에 전달하기 위해 기존 모델에 추가 채널을 받는 것..
Paint by Example 써보기 Paint by Example 논문 리뷰, Paint by Example 코드 리뷰 Hugging face demo를 사용함 Paint by example - a Hugging Face Space by Fantasy-Studio huggingface.co 아키텍처 구조를 봐도 알겠지만 CLIP 인코더를 통과하기에 CLIP에서 학습되지 않은 데이터는 표현하지 못할 것으로 보인다. 원본 곰돌이 세일러문 그냥도 해보고 상체 쪽만 확대해서 했는데도 안 된다. 그림체가 달라서 그런걸까? 오바마는? 약간 애매... 좀 더 그럴듯한 이미지 조합으로 해보자 끔찍하군... 사실 이건 예정된 결과였다. 훈련 데이터셋인 Open Images는 대부분이 natural 이미지인 데다 클래스가 카테고리화되어 있기 때문에 특정 인..
2D convolution의 weight size. Channel 추가하기. 2D 컨볼루션 가중치의 모양은 [output_channel, input_chnnel, kernel_size] 기존 컨볼루션 네트워크를 그대로 사용하면서 추가 채널을 받고 싶으면 모양에 맞는 추가 tensor를 만들고 weight에 합쳐주면 된다. weight_new_channels = torch.zeros(30,10,3,3) new_weight = torch.cat((conv_in.weight,weight_new_channels),dim=1) conv_in.weight = torch.nn.Parameter(new_weight)
DAAM 써보기 DAAM 논문 리뷰, DAAM 코드 리뷰 집컴이 쓰레기라 Colab 씀. 깃허브 가져와서 디렉토리 바꿔주고 !git clone https://github.com/castorini/daam.git %cd /content/daam 라이브러리 설치해주고 !pip install transformers !pip install diffusers 깃허브에 있는 코드 그대로 돌렸는데... from daam import trace, set_seed from diffusers import StableDiffusionPipeline from matplotlib import pyplot as plt import torch model_id = 'stabilityai/stable-diffusion-2-base' device = ..
Colab에 Hugging Face 토큰 등록하기 Colab에서 hugging face의 모델을 로드하려고 하니 에러가 났다... OSError: Token is required (`token=True`), but no token found. You need to provide a token or be logged in to Hugging Face with `huggingface-cli login` or `huggingface_hub.login`. See https://huggingface.co/settings/tokens. 다음과 같이 코드 실행해주고 저기 링크 들어가서 Hugging face 로그인한 뒤에 토큰 만들고 복붙하면 승인됨. 그러면 hugging face 모델을 자유롭게 로드할 수 있다.
DAAM 코드 리뷰 DAAM 논문 리뷰, DAAM 써보기 DAAM Github의 사용 설명서 : 위 코드들이 어떻게 작동하는지 알아보자. DAAM package index에서 DAAM library의 해당 명령어가 github의 어떤 코드를 가리키는지 알 수 있다. 먼저 set_seed : 각 library의 시드를 고정하고 시드 고정된 torch.Generator 객체 반환 def set_seed(seed: int) -> torch.Generator: random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed_all(seed) gen = torch.Generator(device=auto_device()) gen.manual_se..