Skip to content

Commit

Permalink
make work with current and older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ieee8023 authored Jul 29, 2021
1 parent 00ebc95 commit 8554200
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/process_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@


img = skimage.io.imread(cfg.img_path)
img = xrv.datasets.normalize(img, 255, reshape=True)
img = xrv.datasets.normalize(img, 255)

# Check that images are 2D arrays
if len(img.shape) > 2:
img = img[:, :, 0]
if len(img.shape) < 2:
print("error, dimension lower than 2 for image")

# Add color channel
img = img[None, :, :]

transform = torchvision.transforms.Compose([xrv.datasets.XRayCenterCrop(),
xrv.datasets.XRayResizer(224)])
Expand Down

0 comments on commit 8554200

Please sign in to comment.