Comments (10)
If youare working with grayscale images, all color values are same.
try
data_image.append(pixel[y, x] [0])
from jpg-png-to-mnist-nn-format.
Or maybe copy the line three times:
data_image.append(pixel[y, x] [0])
data_image.append(pixel[y, x] [1])
data_image.append(pixel[y, x] [2])
...?
from jpg-png-to-mnist-nn-format.
thank you for replay
but that error happen
data_image.append(pixel[y, x][0])
IndexError: image index out of range
from jpg-png-to-mnist-nn-format.
Check previous lines in your code: pixel
is empty if the image is not loaded.
Make sure that the image loads properly.
from jpg-png-to-mnist-nn-format.
If you are using RGB image, you might need to convert them to gray scale image. Try print(pixel[x,y]). It needs to be an integer I think
from jpg-png-to-mnist-nn-format.
I attempted data_image.append(pixel[y,x][0])
but received the error "TypeError: 'int' object has no attribute 'getitem'"
When I print pixel[0,0] I get a long string of numbers rather than a single integer, which is what I believe I'm trying to get. Does anyone have any suggestions?
from jpg-png-to-mnist-nn-format.
Could you please paste the output here?
from jpg-png-to-mnist-nn-format.
thankyou for question. i solve my problem - just convert rgb to grayscale and it's ok
from jpg-png-to-mnist-nn-format.
Hi ArtemGuy
i have the same problem and i didn't understand how did you convert rgb to grayscale.
could you help me?
File "convert-images-to-mnist-cats-dogs.py", line 40, in
data_image.append(pixel[y,x])
TypeError: an integer is required (got type tuple)
from jpg-png-to-mnist-nn-format.
Hi Hamza-ben,
check this link : https://stackoverflow.com/questions/12201577/how-can-i-convert-an-rgb-image-into-grayscale-in-python#12201744
from jpg-png-to-mnist-nn-format.
Related Issues (20)
- 15 for dirname in os.listdir(name[0])[1:]: # [1:] Excludes .DS_Store from Mac OS
- limited to 28x28 HOT 2
- question about array typecode of data_image HOT 1
- Please help my data is text i want do cnn and lstm
- resize-script.sh error: invalid parameter HOT 1
- Not taking in images from folder 22 HOT 1
- How to use created dataset in others neural networks??? HOT 1
- 'gzip' is not recognized as an internal or external command HOT 1
- Bug/Problem Code lines 15, 46 HOT 1
- NameError: name 'width' is not defined HOT 2
- Size of the output for larger number of images HOT 1
- please help in solving this error HOT 2
- Why labels printed are always 1? HOT 2
- two or three classifications
- Need help with this issue HOT 1
- TypeError: an integer is required (got type tuple) data_image.append(pixel[y,x]) HOT 3
- data_image.append(pixel[y,x]) IndexError: image index out of range HOT 3
- resize-script.sh
- placeholder.txt 这个文件是写什么的?
- some questions please look this:
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 jpg-png-to-mnist-nn-format.