Skip to content

Commit fab26e4

Browse files
committed
fix(dataset): set correct output dir path for gen dataset
1 parent 2663fdf commit fab26e4

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**/.DS_Store
2+
**/._.DS_Store
3+
checkpoints/
4+
**/__pycache__/**
5+
6+
7+
# nicholas local dir
8+
**/assets/**
9+
**/out_single/**
10+
dataset/HalftoneVOC2012/tmp/*

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ python train2_stage1.py -r <path to checkpoint>
5656

5757
# Inference
5858
python inference_single.py \
59-
--input <path to image (.png)> \
60-
--out_dir <output directory> \
61-
--method 'ours'
59+
--input [path to image (.png)] \
60+
--out_dir [output directory] \
61+
--method 'ours'
6262
```
6363

6464
## Citation

configs/train2_stage1.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ training:
1111
model:
1212
init_checkpoint:
1313
reshalf_pretrained: checkpoints/pretrained/reshalf_model_warm.pth.tar
14-
invhalf_pretrained: output/train/PRLNet/b/2022-09-30_17:48:03/checkpoints/model_epoch127.pth.tar
14+
invhalf_pretrained: checkpoints/pretrained/prlnet_epoch127.tar
1515
use_input_y: false
1616
noise_weight: 0.3 # default 0.3
1717
optimizer:

dataset/HalftoneVOC2012/genImageSet.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import cv2
12
import mmcv
23
import os
34
import numpy as np
@@ -6,9 +7,12 @@
67
import subprocess
78

89
# Path to original VOC2012 dataset
9-
input_dir = "dataset/voc2012/VOCdevkit/VOC2012/JPEGImages"
10+
input_dir = "/research/d4/gds/cklau21/Datasets/voc2012/VOCdevkit/VOC2012/JPEGImages"
1011

11-
output_root_dir = 'HalftoneVOC2012_ov'
12+
if not os.path.exists(input_dir):
13+
raise RuntimeError(f"Cannot find input directory {input_dir}, please update the variable input_dir to point to the JPEGImages directory of VOC2012")
14+
15+
output_root_dir = 'HalftoneVOC2012'
1216
input_files = [ f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f)) ]
1317

1418
training_set_boundary = 13758
@@ -27,7 +31,7 @@
2731

2832
def dither_and_save(i):
2933
input_file = input_files[i]
30-
raw_input_img = mmcv.imread(os.path.join(input_dir, input_file), 'color')
34+
raw_input_img = cv2.imread(os.path.join(input_dir, input_file), cv2.IMREAD_COLOR)
3135

3236
# Crop and resize image into 256x256
3337
height, width, channel = raw_input_img.shape

dataset/HalftoneVOC2012/genSpecialSet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import argparse
88
import subprocess
99

10-
output_root_dir = 'special_ov'
10+
output_root_dir = 'special'
1111

1212
max_set = 13758 + 3367
1313
training_set_boundary = 13758

inference_single.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import argparse
33
import os
44
import os.path as path
5-
from logging import info as log
65
from torchvision.transforms import GaussianBlur
76

87
import cv2

0 commit comments

Comments
 (0)