All Questions
Tagged with tf.keras google-colaboratory
31
questions
4
votes
5
answers
29k
views
How can I ignore or remove ".ipynb_checkpoints" in colab?
My code in tf.keras is given below.
I want to retrieve a file(Xscale.npy) in each sub_directory(component_0, component_1) of model_cnn folder.
root_dir = '/content/drive/My Drive/DeepCID/model_cnn'
...
3
votes
2
answers
3k
views
tf.keras how to save ModelCheckPoint object
ModelCheckpoint can be used to save the best model based on a specific monitored metrics. So it obviously has information about the best metrics stored within its object. If you train on google colab ...
3
votes
3
answers
1k
views
Colab+TPU not supporting TF 2.3.0 tf.keras.layers.experimental.preprocessing
I was updating my model using TF 2.3.0 on Colab+TPU based on https://keras.io/examples/vision/image_classification_efficientnet_fine_tuning/, specifically following the Data augmentation and Transfer ...
3
votes
1
answer
653
views
How to find keras.json file in google colab?
On my local system I know where is the keras.json file present(.keras/keras.json) but when I switched to google colab, I don't know where to find it.
I did google search for this problem but have not ...
3
votes
1
answer
890
views
Redirect or view stderr in google colab
I'm trying to view the output of keras.backend.print_tensor in google colab. Some people say that it goes to stderr, assuming IPython notebook is being run locally.
How does one view this output? ...
3
votes
1
answer
1k
views
"Unknown graph" error when using keras application model with tf.functions
This is my code:
import tensorflow as tf
import tensorflow_datasets as tfds
import tensorflow.keras.applications.vgg16 as vgg16
tf.enable_eager_execution()
def resize_image(image, shape = (224,224))...
2
votes
4
answers
2k
views
I can't load my nn model that I've trained and saved
I used transfer learning to train the model. The fundamental model was efficientNet.
You can read more about it here
from tensorflow import keras
from keras.models import Sequential,Model
from keras....
2
votes
2
answers
15k
views
No module named 'tensorflow.python.keras.engine.base_layer_v1' in python code with tensor flow keras
hi i'm doing this code in google colab and i have this error No module named 'tensorflow.python.keras.engine.base_layer_v1' in python code with tensor flow keras
i did use tensorflow.keras instead of ...
2
votes
1
answer
2k
views
ValueError: Shapes (None, 1) and (None, 5) are incompatible in keras
model = Sequential()
model.add(Conv2D(128, (3, 3), activation='relu', input_shape=(64, 64, 3), padding='same'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(64, (3, 3), activation='...
2
votes
1
answer
901
views
flow_from_directory seems to find no images but correctly recognized classes
i have impelmented the code below for loading images from my directory
from keras.preprocessing.image import ImageDataGenerator
DATA_TRAIN_PATH='/content/drive/MyDrive/persiandataset/PersianDataset/...
2
votes
1
answer
604
views
ValueError: Input 0 of layer lstm_17 is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: [None, 128]
Here is the code:
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Embedding, LSTM, RepeatVector, Dense, Reshape
Model = Sequential([
Embedding(vocab_size, ...
1
vote
1
answer
950
views
AttributeError: module 'tensorflow.python.distribute.input_lib' has no attribute 'DistributedDatasetInterface'
I'm trying to run this code for a people counting algorithm.
model = build_model()
epoch = 50
print("total epoch ", epoch)
model.fit(x=train_dataset, shuffle=True, epochs=epoch)
...
1
vote
1
answer
857
views
Saving accuracy and loss with callback on colab
So im trying to train a model on colab, and it is going to take me roughly 70-72 hr of continues running. I have a free account, so i get kicked due to over-use or inactivity pretty frequently, which ...
1
vote
2
answers
357
views
Tensorflow federated can't be imported on google collabs notebook
I wrote following codes on a new google collabs notebook:
!pip install --quiet --upgrade tensorflow-federated-nightly
import tensorflow as tf
import tensorflow_federated as tff
And I got these error ...
1
vote
1
answer
928
views
Keras YoloV3 in on Google Colab, AttributeError: module 'keras.backend' has no attribute 'control_flow_ops
I used Roboflow provided Keras YoloV3 implementation to train my own dataset on Google Colab.
Tried to demo run and the AttributeError occurred.
Failed Solution1: Github Ticket
Tried to change the K....
1
vote
1
answer
373
views
Value error: Shape mismatch - when using tensorflow
When running the code below I get an error, saying there is a shape mismatch, after searching on google I found this is commonly caused by using cross_entropy as a loss function when the target is not ...
0
votes
2
answers
14k
views
How to get rid of this error while using google colab
/usr/local/lib/python3.8/dist-packages/keras/engine/training.py in tf__train_function(iterator)
ValueError: in user code:
File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py&...
0
votes
1
answer
876
views
tf.keras.preprocessing.image.ImageDataGenerator random_transform does not perform rescale
I am using colab and tf version is '2.2.0-rc2'. Using tf.keras.preprocessing.image.ImageDataGenerator to perform a single random transform using .random_transform on a single image does not rescale it ...
0
votes
1
answer
1k
views
ResourceExhaustedError: OOM when allocating tensor with shape[32,128,240,240] and type float on Google Colaboratory
I'm using Google Colaboratory to the following U-NET network:
def unet(pretrained_weights = None,input_size = (240, 240, 1)):
inputs = Input(input_size)
conv1 = Conv2D(64, 3, activation = '...
0
votes
1
answer
775
views
Reproduce same results on each run - Keras, Google Colab
I run the following code in Google Colab(with GPU):
import random
random.seed(1)
import numpy as np
from numpy.random import seed
seed(1)
from tensorflow import set_random_seed
set_random_seed(2)
...
0
votes
0
answers
62
views
I Cannot Use tf.keras.models.load_model() Function
After training the pre-trained models I developed on Google Colab, I saved them and was trying to load the models in the PyCharm environment with the tf.keras.models.load_model() function to use them ...
0
votes
0
answers
38
views
How can I make the prediction run automatically?
I am making my first neural network using Keras libraries in Google Colab.
Once the network is trained, I make predictions like this:
# image path
img_path = '/content/drive/MyDrive/manchas-negras-...
0
votes
0
answers
28
views
Accuracy of Tensorflow Keras Model Not Increasing [duplicate]
Firstly, I'd like to preface by saying I'm a complete rookie; for a project, I'm required to create an "AI" that can analyze a game's "position" and output the correct move, and I ...
0
votes
1
answer
858
views
import "tensorflow.keras.applications" could not be resolved (reportMissingImports) in google-colaboratory
I am trying to import tensorflow.keras.applications in Google Colab. The imported module works fine. There is no compilation error. But, I am being shown a yellow curved underline, kind of a warning.
...
0
votes
0
answers
220
views
Training Dataset on a too big dataset (keras) (google Colab)
I'm trying to train a model with the following code in Colab, using keras:
model.fit(
x_tr, y_tr,
batch_size = 1,
callbacks=[model_checkpoint_callback],
validation_data = (...
0
votes
2
answers
419
views
Recent Google Colab issue after upgrade to tensorflow 2.7 in colab
When I trained my deep Learning model on Google Colab on Nov 4th 2021, I had no issues, The model was trained in half an hour using GPU instance and then default Tensorflow on Google Colab was 2.6. ...
0
votes
1
answer
551
views
Colab: Cannot run any cell after changing the runtime to local
I'm new to Tensorflow and I just started using Google Colab a week ago, and I want to run it locally so that it can use my own CPU to avoid Colab Resource Restrictions, so I followed the Official ...
0
votes
1
answer
261
views
RuntimeError: Unable to create link (name already exists) When saving second model using Google Colab
I have created a model testing pipeline for use in my internship and is run on Google Colab. This pipeline allows for the testing of multiple sets of models and parameters back-to-back. It will spin ...
0
votes
0
answers
1k
views
Keras crashes when calling model.fit with GPU with large-ish datasets, without giving Out of memory however
I'm working using Google Colab, TensorFlow 2.3.0 and tf.keras
I need to run a simple 3D model, that however gets in input a relatively large dataset (batches of 128x128x64x4 images).
If I try to run ...
0
votes
1
answer
701
views
Why my model always return 0 val loss in Keras Tensorflow when trained on Google Colab?
I'm trying to train an easy model on Colab, but it always returns 0 validation loss when using my own code by!python train.py. However, this code runs perfectly fine on my own computer. Does anyone ...
0
votes
1
answer
244
views
ValueError: Error when checking input: expected dense_18_input to have shape (784,) but got array with shape (1,)
I'm testing out tf.keras with tf.data, so I can do minibatch optimization. I'm using the MNIST dataset, and I'm running the code in Google Colab. However, when I try to train the network, I always get ...