Code Monkey home page Code Monkey logo

mask-rcnn_tf2.14.0's Issues

'SGD' object has no attribute 'get_updates'

i got this error . anyone help me in that please.

Epoch 1/10
Traceback (most recent call last):
File "/content/drive/MyDrive/Object segmentation/Testing_Mask-Rcnn/fine-tune-MaskRcnn/beagle.py", line 294, in
train(model)
File "/content/drive/MyDrive/Object segmentation/Testing_Mask-Rcnn/fine-tune-MaskRcnn/beagle.py", line 162, in train
model.train(dataset_train, dataset_val,
File "/usr/local/lib/python3.10/dist-packages/mask_rcnn_tf2-1.0-py3.10.egg/mrcnn/model.py", line 2371, in train
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training_v1.py", line 856, in fit
return func.fit(
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training_generator_v1.py", line 647, in fit
return fit_generator(
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training_generator_v1.py", line 282, in model_iteration
batch_outs = batch_function(*batch_data)
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training_v1.py", line 1180, in train_on_batch
self._make_train_function()
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training_v1.py", line 2284, in _make_train_function
updates = self.optimizer.get_updates(
AttributeError: 'SGD' object has no attribute 'get_updates'.

Predict wrong class

Your code very good but predict class wrong
It always result predicts the first class.

Example we class CLASS_NAMES = ['BG', 'A', 'B', 'C', 'D', 'E', 'F']

your code result predict is class A always Whether using images of other classes

Error when i try to train the model

Hello, this error appears to me when i try to train the model:
ValueError: Dimensions must be equal, but are 256 and 28 for '{{node mrcnn_mask_loss/mul}} = Mul[T=DT_FLOAT](mrcnn_mask_loss/GatherV2_1, mrcnn_mask_loss/Log)' with input shapes: [?,256,256], [?,28,28].

could not broadcast input array from shape (A) into shape (B)

I'm facing a problem with the height and width shapes, already searched for a similar problem but can't find any, I'm trying to training images with scale superior to 1024x1024, but in the 5-10 epoch the training always fail and returns: ValueError: could not broadcast input array from shape (1024,1024,2) into shape (1280,768,2). Why is this happening?

this is my configuration:
Configurations:
BACKBONE resnet101
BACKBONE_STRIDES [4, 8, 16, 32, 64]
BATCH_SIZE 2
BBOX_STD_DEV [0.1 0.1 0.2 0.2]
COMPUTE_BACKBONE_SHAPE None
DETECTION_MAX_INSTANCES 35
DETECTION_MIN_CONFIDENCE 0.7
DETECTION_NMS_THRESHOLD 0.3
FPN_CLASSIF_FC_LAYERS_SIZE 1024
GPU_COUNT 1
GRADIENT_CLIP_NORM 5.0
IMAGES_PER_GPU 2
IMAGE_CHANNEL_COUNT 3
IMAGE_MAX_DIM 1024
IMAGE_META_SIZE 18
IMAGE_MIN_DIM 1024
IMAGE_MIN_SCALE 0
IMAGE_RESIZE_MODE square
IMAGE_SHAPE [1024 1024 3]
LEARNING_MOMENTUM 0.9
LEARNING_RATE 0.001
LOSS_WEIGHTS {'rpn_class_loss': 1.0, 'rpn_bbox_loss': 1.0, 'mrcnn_class_loss': 1.0, 'mrcnn_bbox_loss': 1.0, 'mrcnn_mask_loss': 1.0}
MASK_POOL_SIZE 14
MASK_SHAPE [28, 28]
MAX_GT_INSTANCES 100
MEAN_PIXEL [123.7 116.8 103.9]
MINI_MASK_SHAPE (56, 56)
NAME weathering_cfg
NUM_CLASSES 6
POOL_SIZE 7
POST_NMS_ROIS_INFERENCE 1000
POST_NMS_ROIS_TRAINING 2000
PRE_NMS_LIMIT 6000
ROI_POSITIVE_RATIO 0.33
RPN_ANCHOR_RATIOS [0.5, 1, 2]
RPN_ANCHOR_SCALES (32, 64, 128, 256, 512)
RPN_ANCHOR_STRIDE 1
RPN_BBOX_STD_DEV [0.1 0.1 0.2 0.2]
RPN_NMS_THRESHOLD 0.7
RPN_TRAIN_ANCHORS_PER_IMAGE 256
STEPS_PER_EPOCH 100
TOP_DOWN_PYRAMID_SIZE 256
TRAIN_BN False
TRAIN_ROIS_PER_IMAGE 200
USE_MINI_MASK False
USE_RPN_ROIS True
VALIDATION_STEPS 10
WEIGHT_DECAY 0.0001

And this is the entire error mensage

ValueError Traceback (most recent call last)
Cell In[27], line 19
15 model.load_weights("C:/Users/Ronaldo/Downloads/Mask-RCNN_TF2.14.0-main/weights/mask_rcnn_coco.h5", by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"])
18 # train weights (output layers or 'heads')
---> 19 model.train(train_set, test_set, learning_rate=config.LEARNING_RATE, epochs=100, layers='heads')

File ~\anaconda3\envs\mask-weathering2.3\lib\site-packages\mask_rcnn_tf2-1.0-py3.10.egg\mrcnn\model.py:2371, in MaskRCNN.train(self, train_dataset, val_dataset, learning_rate, epochs, layers, augmentation, custom_callbacks, no_augmentation_sources)
2368 else:
2369 workers = multiprocessing.cpu_count()
-> 2371 self.keras_model.fit(
2372 train_generator,
2373 initial_epoch=self.epoch,
2374 epochs=epochs,
2375 steps_per_epoch=self.config.STEPS_PER_EPOCH,
2376 callbacks=callbacks,
2377 validation_data=val_generator,
2378 validation_steps=self.config.VALIDATION_STEPS,
2379 max_queue_size=100,
2380 workers=0,
2381 use_multiprocessing=False,
2382 )
2383 self.epoch = max(self.epoch, epochs)

File ~\anaconda3\envs\mask-weathering2.3\lib\site-packages\keras\src\engine\training_v1.py:856, in Model.fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
853 self._check_call_args("fit")
855 func = self._select_training_loop(x)
--> 856 return func.fit(
857 self,
858 x=x,
859 y=y,
860 batch_size=batch_size,
861 epochs=epochs,
862 verbose=verbose,
863 callbacks=callbacks,
864 validation_split=validation_split,
865 validation_data=validation_data,
866 shuffle=shuffle,
867 class_weight=class_weight,
868 sample_weight=sample_weight,
869 initial_epoch=initial_epoch,
870 steps_per_epoch=steps_per_epoch,
871 validation_steps=validation_steps,
872 validation_freq=validation_freq,
873 max_queue_size=max_queue_size,
874 workers=workers,
875 use_multiprocessing=use_multiprocessing,
876 )

File ~\anaconda3\envs\mask-weathering2.3\lib\site-packages\keras\src\engine\training_generator_v1.py:647, in GeneratorOrSequenceTrainingLoop.fit(self, model, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing)
643 model._validate_or_infer_batch_size(batch_size, steps_per_epoch, x)
644 training_utils_v1.check_generator_arguments(
645 y, sample_weight, validation_split=validation_split
646 )
--> 647 return fit_generator(
648 model,
649 x,
650 steps_per_epoch=steps_per_epoch,
651 epochs=epochs,
652 verbose=verbose,
653 callbacks=callbacks,
654 validation_data=validation_data,
655 validation_steps=validation_steps,
656 validation_freq=validation_freq,
657 class_weight=class_weight,
658 max_queue_size=max_queue_size,
659 workers=workers,
660 use_multiprocessing=use_multiprocessing,
661 shuffle=shuffle,
662 initial_epoch=initial_epoch,
663 steps_name="steps_per_epoch",
664 )

File ~\anaconda3\envs\mask-weathering2.3\lib\site-packages\keras\src\engine\training_generator_v1.py:239, in model_iteration(model, data, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, validation_freq, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch, mode, batch_size, steps_name, **kwargs)
237 step = 0
238 while step < target_steps:
--> 239 batch_data = _get_next_batch(generator)
240 if batch_data is None:
241 if is_dataset:
242 # The dataset passed by the user ran out of batches. Now we
243 # know the cardinality of the dataset. If steps_per_epoch
244 # was specified, then running out of data is unexpected, so
245 # we stop training and inform the user.

File ~\anaconda3\envs\mask-weathering2.3\lib\site-packages\keras\src\engine\training_generator_v1.py:388, in _get_next_batch(generator)
386 """Retrieves the next batch of input data."""
387 try:
--> 388 generator_output = next(generator)
389 except (StopIteration, tf.errors.OutOfRangeError):
390 return None

File ~\anaconda3\envs\mask-weathering2.3\lib\site-packages\keras\src\utils\data_utils.py:581, in iter_sequence_infinite(seq)
572 """Iterates indefinitely over a Sequence.
573
574 Args:
(...)
578 Batches of data from the Sequence.
579 """
580 while True:
--> 581 for item in seq:
582 yield item

File ~\anaconda3\envs\mask-weathering2.3\lib\site-packages\keras\src\utils\data_utils.py:567, in Sequence.iter(self)
565 def iter(self):
566 """Create a generator that iterate over the Sequence."""
--> 567 for item in (self[i] for i in range(len(self))):
568 yield item

File ~\anaconda3\envs\mask-weathering2.3\lib\site-packages\keras\src\utils\data_utils.py:567, in (.0)
565 def iter(self):
566 """Create a generator that iterate over the Sequence."""
--> 567 for item in (self[i] for i in range(len(self))):
568 yield item

File ~\anaconda3\envs\mask-weathering2.3\lib\site-packages\mask_rcnn_tf2-1.0-py3.10.egg\mrcnn\model.py:1796, in DataGenerator.getitem(self, idx)
1794 batch_gt_class_ids[b, :gt_class_ids.shape[0]] = gt_class_ids
1795 batch_gt_boxes[b, :gt_boxes.shape[0]] = gt_boxes
-> 1796 batch_gt_masks[b, :, :, :gt_masks.shape[-1]] = gt_masks
1797 if self.random_rois:
1798 batch_rpn_rois[b] = rpn_rois

ValueError: could not broadcast input array from shape (1024,1024,2) into shape (1280,768,2)

Cannot use GPU training

微信图片_20240528141407
During training, the utilization rate of gpu is 0 and only cpu is used for training. My gpu is 3060 and cuda version is 11.8

Train Fail

model.train(dataset_train, dataset_val,
learning_rate=config.LEARNING_RATE , # lr yerine learning_rate kullanılıyor
epochs=2,
layers="head")

code is fail :

ValueError Traceback (most recent call last)
in <cell line: 8>()
6
7 # Eğitim fonksiyonunu çalıştırın
----> 8 model.train(dataset_train, dataset_val,
9 learning_rate=config.LEARNING_RATE , # lr yerine learning_rate kullanılıyor
10 epochs=2,

3 frames
/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/model.py in train(self, train_dataset, val_dataset, learning_rate, epochs, layers, augmentation, custom_callbacks, no_augmentation_sources)
2359 ]
2360
-> 2361 # Add custom callbacks to the list
2362 if custom_callbacks:
2363 callbacks += custom_callbacks

/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/model.py in compile(self, learning_rate, momentum)
2190 for w in self.keras_model.trainable_weights
2191 if 'gamma' not in w.name and 'beta' not in w.name]
-> 2192
2193
2194

/usr/local/lib/python3.10/dist-packages/tensorflow/python/util/traceback_utils.py in error_handler(*args, **kwargs)
151 except Exception as e:
152 filtered_tb = _process_traceback_frames(e.traceback)
--> 153 raise e.with_traceback(filtered_tb) from None
154 finally:
155 del filtered_tb

/usr/local/lib/python3.10/dist-packages/tensorflow/python/ops/math_ops.py in add_n(inputs, name)
4136 """
4137 if not inputs or not isinstance(inputs, collections_abc.Iterable):
-> 4138 raise ValueError("Inputs must be an iterable of at least one "
4139 "Tensor/IndexedSlices with the same dtype and shape.")
4140 inputs = indexed_slices.convert_n_to_tensor_or_indexed_slices(inputs)

ValueError: Inputs must be an iterable of at least one Tensor/IndexedSlices with the same dtype and shape.

what is the solution ?
Thanks.

Getting weird predictions.

Hi, me and my friend have been training our custom dataset from scratch and the training is going well but when we're trying to make predictions we get really weird results. What could be wrong?
Screenshot 2024-06-05 123653

Using other optimizers

Hi, I have a question about using different optimizers. Do you know how to change or configure the optimizer so we can use something like Adam?

Run with GPU

Hi, thanks for the updated repo of matterports model! I was wondering since you run this on GPU, how did you install CUDA and cuDNN? I've tried many ways of installing it and didnt manage to get it working. Thanks again

train False

Create model in training mode

model = modellib.MaskRCNN(mode="training", config=config,
model_dir=MODEL_DIR)

AttributeError Traceback (most recent call last)
in <cell line: 2>()
1 # Create model in training mode
----> 2 model = modellib.MaskRCNN(mode="training", config=config,
3 model_dir=MODEL_DIR)

19 frames
/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/model.py in init(self, mode, config, model_dir)
1842 self.model_dir = model_dir
1843 self.set_log_dir()
-> 1844 self.keras_model = self.build(mode=mode, config=config)
1845
1846 def build(self, mode, config):

/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/model.py in build(self, mode, config)
2003 # padded. Equally, returned rois and targets are zero padded.
2004 rois, target_class_ids, target_bbox, target_mask =
-> 2005 DetectionTargetLayer(config, name="proposal_targets")([
2006 target_rois, input_gt_class_ids, gt_boxes, input_gt_masks])
2007

/usr/local/lib/python3.10/dist-packages/keras/src/engine/base_layer_v1.py in call(self, *args, **kwargs)
836 self._compute_dtype_object
837 ):
--> 838 outputs = call_fn(cast_inputs, *args, **kwargs)
839
840 except tf.errors.OperatorNotAllowedInGraphError as e:

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/impl/api.py in wrapper(*args, **kwargs)
691 except Exception as e: # pylint:disable=broad-except
692 if hasattr(e, 'ag_error_metadata'):
--> 693 raise e.ag_error_metadata.to_exception(e)
694 else:
695 raise

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/impl/api.py in wrapper(*args, **kwargs)
688 try:
689 with conversion_ctx:
--> 690 return converted_call(f, args, kwargs, options=options)
691 except Exception as e: # pylint:disable=broad-except
692 if hasattr(e, 'ag_error_metadata'):

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/impl/api.py in converted_call(f, args, kwargs, caller_fn_scope, options)
437 try:
438 if kwargs is not None:
--> 439 result = converted_f(*effective_args, **kwargs)
440 else:
441 result = converted_f(*effective_args)

/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/model.py in tf__call(self, inputs)
13 gt_masks = ag__.ld(inputs)[3]
14 names = ['rois', 'target_class_ids', 'target_bbox', 'target_mask']
---> 15 outputs = ag__.converted_call(ag__.ld(utils).batch_slice, ([ag__.ld(proposals), ag__.ld(gt_class_ids), ag__.ld(gt_boxes), ag__.ld(gt_masks)], ag__.autograph_artifact(lambda w, x, y, z: ag__.converted_call(ag__.ld(detection_targets_graph), (ag__.ld(w), ag__.ld(x), ag__.ld(y), ag__.ld(z), ag__.ld(self).config), None, fscope)), ag__...
16 try:
17 do_return = True

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/impl/api.py in converted_call(f, args, kwargs, caller_fn_scope, options)
437 try:
438 if kwargs is not None:
--> 439 result = converted_f(*effective_args, **kwargs)
440 else:
441 result = converted_f(*effective_args)

/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/utils.py in tf__batch_slice(inputs, graph_fn, batch_size, names)
66 inputs_slice = ag__.Undefined('inputs_slice')
67 output_slice = ag__.Undefined('output_slice')
---> 68 ag__.for_stmt(ag__.converted_call(ag__.ld(range), (ag__.ld(batch_size),), None, fscope), None, loop_body, get_state_2, set_state_2, (), {'iterate_names': 'i'})
69 outputs = ag__.converted_call(ag__.ld(list), (ag__.converted_call(ag__.ld(zip), tuple(ag__.ld(outputs)), None, fscope),), None, fscope)
70

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/operators/control_flow.py in for_stmt(iter_, extra_test, body, get_state, set_state, symbol_names, opts)
447 for_fn = tf_distributed_iterable_for_stmt
448
--> 449 for_fn(iter
, extra_test, body, get_state, set_state, symbol_names, opts)
450
451

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/operators/control_flow.py in py_for_stmt(failed resolving arguments)
498 else:
499 for target in iter
:
--> 500 body(target)
501
502

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/operators/control_flow.py in protected_body(protected_iter)
464 original_body = body
465 def protected_body(protected_iter):
--> 466 original_body(protected_iter)
467 after_iteration()
468 before_iteration()

/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/utils.py in loop_body(itr)
45 i = itr
46 inputs_slice = [ag__.ld(x)[ag__.ld(i)] for x in ag__.ld(inputs)]
---> 47 output_slice = ag__.converted_call(ag__.ld(graph_fn), tuple(ag__.ld(inputs_slice)), None, fscope)
48
49 def get_state_1():

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/impl/api.py in converted_call(f, args, kwargs, caller_fn_scope, options)
337 if is_autograph_artifact(f):
338 logging.log(2, 'Permanently allowed: %s: AutoGraph artifact', f)
--> 339 return _call_unconverted(f, args, kwargs, options)
340
341 # If this is a partial, unwrap it and redo all the checks.

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/impl/api.py in _call_unconverted(f, args, kwargs, options, update_cache)
458 if kwargs is not None:
459 return f(*args, **kwargs)
--> 460 return f(*args)
461
462

/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/model.py in (w, x, y, z)
13 gt_masks = ag__.ld(inputs)[3]
14 names = ['rois', 'target_class_ids', 'target_bbox', 'target_mask']
---> 15 outputs = ag__.converted_call(ag__.ld(utils).batch_slice, ([ag__.ld(proposals), ag__.ld(gt_class_ids), ag__.ld(gt_boxes), ag__.ld(gt_masks)], ag__.autograph_artifact(lambda w, x, y, z: ag__.converted_call(ag__.ld(detection_targets_graph), (ag__.ld(w), ag__.ld(x), ag__.ld(y), ag__.ld(z), ag__.ld(self).config), None, fscope)), ag__...
16 try:
17 do_return = True

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/impl/api.py in converted_call(f, args, kwargs, caller_fn_scope, options)
439 result = converted_f(*effective_args, **kwargs)
440 else:
--> 441 result = converted_f(*effective_args)
442 except Exception as e:
443 _attach_error_metadata(e, converted_f)

/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/model.py in tf__detection_targets_graph(proposals, gt_class_ids, gt_boxes, gt_masks, config)
61 roi_gt_boxes = ag__.converted_call(ag__.ld(tf).gather, (ag__.ld(gt_boxes), ag__.ld(roi_gt_box_assignment)), None, fscope)
62 roi_gt_class_ids = ag__.converted_call(ag__.ld(tf).gather, (ag__.ld(gt_class_ids), ag__.ld(roi_gt_box_assignment)), None, fscope)
---> 63 deltas = ag__.converted_call(ag__.ld(utils).box_refinement_graph, (ag__.ld(positive_rois), ag__.ld(roi_gt_boxes)), None, fscope)
64 deltas = ag__.ld(deltas)
65 deltas /= config.BBOX_STD_DEV

/usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/impl/api.py in converted_call(f, args, kwargs, caller_fn_scope, options)
439 result = converted_f(*effective_args, **kwargs)
440 else:
--> 441 result = converted_f(*effective_args)
442 except Exception as e:
443 _attach_error_metadata(e, converted_f)

/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/utils.py in tf__box_refinement_graph(box, gt_box)
23 dy = (ag__.ld(gt_center_y) - ag__.ld(center_y)) / ag__.ld(height)
24 dx = (ag__.ld(gt_center_x) - ag__.ld(center_x)) / ag__.ld(width)
---> 25 dh = ag__.converted_call(ag__.ld(tf).log, (ag__.ld(gt_height) / ag__.ld(height),), None, fscope)
26 dw = ag__.converted_call(ag__.ld(tf).log, (ag__.ld(gt_width) / ag__.ld(width),), None, fscope)
27 result = ag__.converted_call(ag__.ld(tf).stack, ([ag__.ld(dy), ag__.ld(dx), ag__.ld(dh), ag__.ld(dw)],), dict(axis=1), fscope)

AttributeError: in user code:

File "/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/model.py", line 691, in call  *
    outputs = utils.batch_slice(
File "/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/utils.py", line 829, in batch_slice  *
    output_slice = graph_fn(*inputs_slice)
File "/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/model.py", line 600, in detection_targets_graph  *
    deltas = utils.box_refinement_graph(positive_rois, roi_gt_boxes)
File "/content/gdrive/MyDrive/maskrcnn/maskrcnn/mrcnn/utils.py", line 200, in box_refinement_graph  *
    dh = tf.log(gt_height / height)

AttributeError: module 'tensorflow' has no attribute 'log'

What is the solution?
Thanks.

keras.optimizers.legacy.SGD() not working

Traceback (most recent call last):
File "/content/Mask-RCNN_TF2.14.0/samples/balloon/balloon.py", line 317, in
train(model)
File "/content/Mask-RCNN_TF2.14.0/samples/balloon/balloon.py", line 149, in train
model.train(dataset_train, dataset_val,
File "/usr/local/lib/python3.10/dist-packages/mask_rcnn_tf2-1.0-py3.10.egg/mrcnn/model.py", line 2371, in train
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training_v1.py", line 856, in fit
return func.fit(
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training_generator_v1.py", line 647, in fit
return fit_generator(
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training_generator_v1.py", line 282, in model_iteration
batch_outs = batch_function(*batch_data)
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training_v1.py", line 1180, in train_on_batch
self._make_train_function()
File "/usr/local/lib/python3.10/dist-packages/keras/src/engine/training_v1.py", line 2284, in _make_train_function
updates = self.optimizer.get_updates(
AttributeError: 'SGD' object has no attribute 'get_updates'

I have changed the SGD optimizer to the legacy one, but error still presists.
optimizer = tf.keras.optimizers.legacy.SGD(lr=learning_rate, momentum=momentum, clipnorm=self.config.GRADIENT_CLIP_NORM)

SGD optimizer

I have a problem like this:

in _make_train_function
updates = self.optimizer.get_updates(
AttributeError: 'SGD' object has no attribute 'get_updates'

How can I fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.