harvitronix / five-video-classification-methods

Code that accompanies my blog post outlining five video classification methods in Keras and TensorFlow
https://medium.com/@harvitronix/five-video-classification-methods-implemented-in-keras-and-tensorflow-99cad29cc0b5
MIT License
1.17k stars 479 forks source link

Train cnn: Tensor object has no attribute 'assign' #129

Open AaliaLokhandwala opened 5 years ago

AaliaLokhandwala commented 5 years ago

Using TensorFlow backend. WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. 2019-05-01 02:46:24.693902: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2300000000 Hz 2019-05-01 02:46:24.694102: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x194c520 executing computations on platform Host. Devices: 2019-05-01 02:46:24.694132: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): , 2019-05-01 02:46:24.836873: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:998] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2019-05-01 02:46:24.837390: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x194be40 executing computations on platform CUDA. Devices: 2019-05-01 02:46:24.837419: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): Tesla T4, Compute Capability 7.5 2019-05-01 02:46:24.837783: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties: name: Tesla T4 major: 7 minor: 5 memoryClockRate(GHz): 1.59 pciBusID: 0000:00:04.0 totalMemory: 14.73GiB freeMemory: 13.89GiB 2019-05-01 02:46:24.837808: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0 2019-05-01 02:46:25.343197: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix: 2019-05-01 02:46:25.343268: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0 2019-05-01 02:46:25.343287: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0: N 2019-05-01 02:46:25.343569: W tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.cc:42] Overriding allow_growth setting because the TF_FORCE_GPU_ALLOW_GROWTH environment variable is set. Original config value was 0. 2019-05-01 02:46:25.343623: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 13426 MB memory) -> physical GPU (device: 0, name: Tesla T4, pci bus id: 0000:00:04.0, compute capability: 7.5) Downloading data from https://github.com/fchollet/deep-learning-models/releases/download/v0.5/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 87916544/87910968 [==============================] - 8s 0us/step Found 31458 images belonging to 101 classes. Found 0 images belonging to 101 classes. Loading network from ImageNet weights. WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead. Traceback (most recent call last): File "train_cnn.py", line 137, in main(weights_file) File "train_cnn.py", line 125, in main model = train_model(model, 10, generators) File "train_cnn.py", line 114, in train_model callbacks=callbacks) File "/usr/local/lib/python3.6/dist-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, *kwargs) File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1418, in fit_generator initial_epoch=initial_epoch) File "/usr/local/lib/python3.6/dist-packages/keras/engine/training_generator.py", line 40, in fit_generator model._make_train_function() File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 509, in _make_train_function loss=self.total_loss) File "/usr/local/lib/python3.6/dist-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/keras/optimizers.py", line 269, in get_updates self.updates.append(K.update(a, new_a)) File "/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py", line 973, in update return tf.assign(x, new_x) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/state_ops.py", line 224, in assign return ref.assign(value, name=name) AttributeError: 'Tensor' object has no attribute 'assign'

Can someone please help with this error?