Coder Social home page Coder Social logo

kang-changwoo / modified_structureflow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from renyurui/structureflow

0.0 0.0 0.0 104.51 MB

Code for paper "StructureFlow: Image Inpainting via Structure-aware Appearance Flow"

C++ 0.72% Python 64.98% MATLAB 10.78% Cuda 17.47% Jupyter Notebook 5.34% Shell 0.71%

modified_structureflow's Introduction

ModifiedStructureFlow

예시 결과물 (Inpainting results)

  • 참고를 위한 인페인팅 결과물은 아래와 같습니다.

필요한 라이브러리 (Requirements)

( RTX 3090-24GB 환경에서 구동하기 위한 설정입니다. )

  1. Pytorch 1.10.1 (modified from Pytorch >= 1.0)
  2. Python 3.9.5 (modified from Python 3)
  3. NVIDIA GPU + CUDA 11.3 (modified from NVIDIA GPU + CUDA 9.0)

그 외 버전에 영향 없는 라이브러리는 필요 시 설치해주시면 됩니다.

  1. Tensorboard
  2. Matlab
  3. Pandas
  4. Numpy

설치법 (Installation)

  1. 본 저장소를 클론한다.

    git clone https://github.com/Kang-ChangWoo/Modified_StructureFlow.git
  2. 가우시안 샘플링(Gaussian Sampling) 목적의 쿠다(CUDA) 패키지를 빌드한다.

    (c++ 버전은 기존 c++ 11에서 c++ 14로 변경했으며, GPU architecture는 sm_80, sm_86 으로 설정했습니다.)

    cd ./StructureFlow/resample2d_package
    python setup.py install --user
  3. 앞서 언급한, 필요한 라이브러리를 설치한다.

구동 (Running)

1. 이미지 준비하기

기존 선행 연구는 세 가지 공개 데이터셋에서 학습 됐습니다. (Places2, Celeba, and Paris StreetView) 하지만, 본 프로젝트에서는 하단 데이터셋만을 활용하여 테스트하고자 합니다. 필요한 데이터는 evaluation_dataset/input/ 위치에 저장되어 있습니다. 미리 스무딩한 이미지도 evaluation_dataset/pred_structure/에 저장되어 있으니 그대로 사용하면 됩니다. (해당 방식은 각 이미지를 가장자리만 남도록 스무딩한 이미지를 RTV smooth method를 통해 획득했으며, 내장된 scripts/matlab/generate_structre_images.m 을 matlab을 통해서 실행 시켜서 획득했습니다.)

각 이미지를 얻은 다음에는 scripts/flist.py를 통해 파일 목록을 생성해 학습 및 테스트에 활용해야 합니다. 각 파일을 생성한 다음엔 flist/경로에 각각 저장해주어야 합니다.

2. 테스트 (Testing)

사전에 학습된 모델 가중치는 다음에서 다운로드 받을 수 있습니다.

해당 체크포인트를 다운로드 받은 다음에 ./path_of_your_experiments/name_of_your_experiment/checkpoints 위치에 저장합니다. 예를 들어, celeba 체크포인트를 다운 받았다면, .results/celeba/checkpoints에 저장한 뒤 아래 코드를 실행하면 됩니다:

python test.py \
--name=celeba \
--path=results \
--input=./evaluation_dataset/input/ \
--mask=./evaluation_dataset/masks/ \
--structure=./evaluation_dataset/pred_structure/ \
--output=./results/celeba/result/ \
--model=3

3. 경로 설정해주기

또한 config.yaml파일의 최하단 경로 다섯 개를 생성한 .flist의 경로에 맞게 수정해주어야 합니다.

  • DATA_VAL_GT
  • DATA_TRAIN_GT
  • DATA_TRAIN_STRUCTURE
  • DATA_TRAIN_GT
  • DATA_TRAIN_STRUCTURE

modified_structureflow's People

Contributors

kang-changwoo avatar renyurui avatar xiaoming-yu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.