Comments (5)
I asked this question because when i evaluate model on single image like this:
img = Image.open(img_name) # from PIL import Image
img = img.resize((IMG_SIZE, IMG_SIZE), resample=PIL.Image.BILINEAR) # import PIL
img=img.convert('RGB')
img = np.expand_dims(np.asarray(img), axis=0) # model was trained on batches so add one dimension for batch
logits_array=tl_head_model.predict(img, verbose=0)[0]
y_pred= np.argmax(logits_array)
my predictions are good for images in folder 0, 1 and shifted for all other folder: expect 3, got 4, expect 4, got 5, expect 2 got 10.
from keras.
Hi @satyrmipt -
Here in keras.utils.image_dataset_from_directory
, label_mode
is a string describing encoding of labels.
label_mode='int'
means labels are encoded as integer.
label_mode='categorical'
means labels are encoded as categorical.
Find more details regarding keras.utils.image_dataset_from_directory
here.
As per your data directory folder is based on class names. So this "np.argmax(lbl, axis = - 1)"
will return class number in alphanumerically ordered class labels converted to strings like it will return index 2 for class 10(10 folder). Because keras.utils.image_dataset_from_directory
uses labels sorted according to the alphanumeric order of the image file paths.
from keras.
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.
from keras.
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.
from keras.
Are you satisfied with the resolution of your issue?
Yes
No
from keras.
Related Issues (20)
- Drop in timing performance from Keras 2 to Keras 3 with TensorFlow as backend HOT 5
- Can't load a saved model, Keras 3.4 regression HOT 2
- error happen in tensorflow framework_impl
- how to implement a tflite compatible SVDF layer HOT 5
- ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concatenation axis. Received: input_shape=[(None, 88, 88, 128), (None, 89, 89, 128)] HOT 1
- LAMB optimizer for keras3 HOT 4
- keras.Variable no longer has ref method HOT 1
- Keras 3.4.2 release HOT 2
- ModelCheckpoint saving the model returns error ".save() got an unexpected keyword argument 'overwrite'" HOT 1
- "ValueError: Undefined shapes are not supported." when calling model.call() HOT 3
- Support for channels first data format with zeropadding1D
- model.save fail after updating to keras-nightly HOT 2
- `padding_mode` in convolutions HOT 2
- Gradient accumulation done wrong
- Regression bug when using 3D convolution with channels_first on GPU HOT 2
- Optimizers in Keras V3 are slower than in V2 when working with sparse gradients HOT 2
- Accuracy Drop Across TensorFlow Versions When Using Keras 3 Instead of Keras 2
- keras.utils.PyDataset / tf.keras.utils.Sequence ignoring __len__ different behavior Keras2/Keras3 (tensorflow 2.16) HOT 2
- Incorrect handling of `nan` in `in_top_k` of Jax backend (regression from keras 3.3.3)
- predict_on_batch fails when the model was compiled with steps_per_execution > 1
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 keras.