Skip to content

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

Merged
merged 1 commit into from
Apr 21, 2017
Merged

Add support for accimage.Image #153

merged 1 commit into from
Apr 21, 2017

Conversation

colesbury
Copy link
Member

It can be enabled by setting torchvision.image_backend = 'accimage'

I've rebased and updated @Maratyszcza PR with tests

cc @Maratyszcza

@colesbury colesbury force-pushed the accimage branch 3 times, most recently from 6ee863c to d8791f4 Compare April 21, 2017 00:06
@apaszke
Copy link
Contributor

apaszke commented Apr 21, 2017

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 set_image_backend.

@colesbury
Copy link
Member Author

I replaced the attribute with a setter

@colesbury colesbury force-pushed the accimage branch 2 times, most recently from 9e67dd4 to bd4c988 Compare April 21, 2017 17:06
@colesbury
Copy link
Member Author

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
PIL: Prec@1 76.146 Prec@5 92.872
accimage: Prec@1 76.154 Prec@5 92.880

ResNet-18:
PIL: Prec@1 69.760 Prec@5 89.080
accimage: Prec@1 69.740 Prec@5 89.084

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.

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.

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.

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.

It can be enabled by calling torchvision.set_image_backend('accimage')
@soumith soumith merged commit 1f2c15f into master Apr 21, 2017
@vincentqb vincentqb mentioned this pull request Dec 3, 2019
14 tasks
@datumbox datumbox deleted the accimage branch August 27, 2021 09:00
rajveerb pushed a commit to rajveerb/vision that referenced this pull request Nov 30, 2023
* remove pycache

* bring updated logging util to head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants