열정/연구 일지

[연구 일지] SGG를 위한 Visual Genome Dataset 정리 방법

lime9 2024. 2. 19. 10:20

데이터 세트 관리가 너무 어렵다...

 

 

1. Visual Genome Dataset 다운로드

https://homes.cs.washington.edu/~ranjay/visualgenome/api.html

 

VisualGenome

 

homes.cs.washington.edu

 

part 1 (9.2 GB), part 2 (5.47 GB), meta data (17.62 MB)를 받으면 된다.

Task에 따라 다운로드 받을 데이터는 달라지겠지만 대부분의 SGG 논문에서는 이 세 개를 활용하는 것 같다.

 

각각 압축을 풀어준 후에 하나의 파일에 병합하여 저장하면 된다. 데이터가 크다보니 압축을 풀 때, UI에서 진행하는 것보다 코드로 진행하는 것이 에러 없이 잘 열리는 것을 확인했다.

# pwd: ~/Sem-USRP/sgg-master/data/VG/
import zipfile

def zipextract(zip_file_path, extract_folder):
    with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:
        zip_ref.extractall(extract_folder)

# path to zip files and extract destination
path1 = 'images.zip'
path2 = 'images2.zip'
extract_folder = 'VG_100K'

# extract images.zip
zipextract(path1, extract_folder)
print(f'{path1} successfully extracted in {extract_folder}')

# extract images2.zip
zipextract(path2, extract_folder)
print(f'{path2} successfully extracted in {extract_folder}')

 

zip 파일의 경로는 현재 내가 작업하는 곳에서의 상대 경로 또는 절대 경로로 작성하면 된다.

 

 

2. SGG에 활용할 추가 파일 다운로드

내가 사용할 코드에서는 추가적으로 HDf5, JSON 파일을 사용한다.

다운로드 후 압축을 풀어주면 된다.

 

[scene graphs] http://cvgl.stanford.edu/scene-graph/dataset/VG-SGG.h5

 

[scene graph meta data] http://cvgl.stanford.edu/scene-graph/dataset/VG-SGG-dicts.json

 

[checkpoints] https://drive.google.com/open?id=11zKRr2OF5oclFL47kjFYBOxScotQzArX

 

vg-faster-rcnn.tar

 

drive.google.com