Comments (4)
What software are you using to view 4 channels? Is this CMYK? You should be able to interpret the images as 3-channel (RGB).
from nlvr.
from PIL import Image
import numpy as np
img_filename = '../../../Dataset/nlvr/train/images/1/train-1196-0-0.png'
img = Image.open(img_filename)
print(np.array(img).shape)
This gives an output as (100, 400, 4).
So, I am using the below snippet:
from PIL import Image
import numpy as np
img_filename = '../../../Dataset/nlvr/train/images/1/train-1196-0-0.png'
img = Image.open(img_filename).convert('RGB')
print(np.array(img).shape)
This gives me an output of (100, 400, 3) but I have to divide them by 255 to make the values lie in between 0 and 1.
from nlvr.
I'm not very familiar with PIL, and in our code we use scipy imread (which calls PIL and gives us four channels -- we throw away the last channel). The last channel value is 255 for us, so I would guess this is some kind of alpha value. I'd suggest ignoring this channel because the values are all the same for each example. I'd also suggest dividing by 255. But you can investigate with PIL to see if it can do all of this by default for you. Does this answer your question?
from nlvr.
Yes, this does answer my question. Thank you for the quick reply.
from nlvr.
Related Issues (8)
- Broken json files HOT 1
- Typos in the dataset HOT 1
- question about Implementation details of Image Features+RNN HOT 1
- License? HOT 1
- Vocabulary words HOT 1
- Label distributions HOT 2
- NLVR dataset uploaded & visualized at tagtog HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nlvr.