Unverified Commit a0e5bbea authored by Francisco Massa's avatar Francisco Massa Committed by GitHub
Browse files

Remove torchvision.io from test_utils.py (#3092)

For now this simplifies a few things for fbcode integration. We can add this back in the future
parent ac288eaf
import numpy as np
import os import os
import sys import sys
import tempfile import tempfile
...@@ -6,7 +7,6 @@ import torchvision.utils as utils ...@@ -6,7 +7,6 @@ import torchvision.utils as utils
import unittest import unittest
from io import BytesIO from io import BytesIO
import torchvision.transforms.functional as F import torchvision.transforms.functional as F
from torchvision.io.image import read_image, write_png
from PIL import Image from PIL import Image
...@@ -90,9 +90,10 @@ class Tester(unittest.TestCase): ...@@ -90,9 +90,10 @@ class Tester(unittest.TestCase):
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets", "fakedata", "draw_boxes_util.png") path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets", "fakedata", "draw_boxes_util.png")
if not os.path.exists(path): if not os.path.exists(path):
write_png(result, path) res = Image.fromarray(result.permute(1, 2, 0).contiguous().numpy())
res.save(path)
expected = read_image(path) expected = torch.as_tensor(np.array(Image.open(path))).permute(2, 0, 1)
self.assertTrue(torch.equal(result, expected)) self.assertTrue(torch.equal(result, expected))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment