Skip to content

Commit

Permalink
Update dataset_tool.py
Browse files Browse the repository at this point in the history
  • Loading branch information
drboog committed Mar 27, 2022
1 parent 5b48186 commit acf5010
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dataset_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import torch.nn.functional as F
import torchvision.transforms as T
import torch

import cv2

def custom_reshape(img, mode='bicubic', ratio=0.99): # more to be implemented here
full_size = img.shape[-2]
Expand Down Expand Up @@ -90,6 +90,10 @@ def iterate_images():
arch_fname = arch_fname.replace('\\', '/')
try:
img = np.array(PIL.Image.open(fname))

if img.shape[2] == 4:
img = cv2.cvtColor(img, cv2.COLOR_BGRA2BGR)

try:
with open(fname[:-4] + '.txt', 'r') as file:
txt = file.read().split('\n')
Expand Down

0 comments on commit acf5010

Please sign in to comment.