-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Add support for accimage.Image #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6ee863c
to
d8791f4
Compare
Can we stop using module attributes for settings? It annoying because there's no way to execute some code when the backend is changed (e.g. some kind of init). I'd be for adding |
I replaced the attribute with a setter |
9e67dd4
to
bd4c988
Compare
After fixing an issue with resize in accimage, the ResNet evaluation gives very similar results with PIL and with accimage. (All models were trained with PIL) ResNet-50 ResNet-18: |
test/test_transforms.py
Outdated
vis.image((expected_output - output).numpy()) | ||
|
||
self.assertEqual(expected_output.size(), output.size()) | ||
assert np.allclose(output.numpy(), expected_output.numpy()) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
test/test_transforms.py
Outdated
expected_output = trans(Image.open(GRACE_HOPPER).convert('RGB')) | ||
output = trans(accimage.Image(GRACE_HOPPER)) | ||
|
||
import visdom |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
batch_count = 100 * args.nThreads | ||
for i in tqdm(xrange(batch_count)): | ||
batch_count = 20 * args.nThreads | ||
for _ in tqdm(range(batch_count)): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
self.assertEqual(expected_output.size(), output.size()) | ||
self.assertLess(np.abs((expected_output - output).mean()), 1e-3) | ||
self.assertLess((expected_output - output).var(), 1e-5) | ||
# note the high absolute tolerance |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
It can be enabled by calling torchvision.set_image_backend('accimage')
* remove pycache * bring updated logging util to head
It can be enabled by setting torchvision.image_backend = 'accimage'
I've rebased and updated @Maratyszcza PR with tests
cc @Maratyszcza