Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed precondition: Attempting to use uninitialized value yolo_layer_ #292

Open
ar-ramchandra opened this issue Jul 16, 2020 · 1 comment

Comments

@ar-ramchandra
Copy link

ar-ramchandra commented Jul 16, 2020

First of all, thank you for your amazing work! I have learned so very much in trying to implement this!

I'm sorry if I'm doing something wrong, I'm very new to this field.

Initially, I was getting an error with tf.float() in YOLO.py

After a variety of searches, adding the following line just after the imports fixed it:

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

Now, I am getting an error in train.py

---------------------------------------------------------------------------
FailedPreconditionError                   Traceback (most recent call last)
~\Documents\GitStuff\cv capstone\CapstonecvYOLO REAL\keras-yolo3\train.py in <module>
    289 
    290     args = argparser.parse_args()
--> 291     _main_(args)

~\Documents\GitStuff\cv capstone\CapstonecvYOLO REAL\keras-yolo3\train.py in _main_(args)
    259     callbacks = create_callbacks(config['train']['saved_weights_name'], config['train']['tensorboard_dir'], infer_model)
    260 
--> 261     train_model.fit_generator(
    262         generator        = train_generator,
    263         steps_per_epoch  = len(train_generator) * config['train']['train_times'],

c:\users\offic\venv\lib\site-packages\keras\legacy\interfaces.py in wrapper(*args, **kwargs)
     89                 warnings.warn('Update your `' + object_name + '` call to the ' +
     90                               'Keras 2 API: ' + signature, stacklevel=2)
---> 91             return func(*args, **kwargs)
     92         wrapper._original_function = func
     93         return wrapper

c:\users\offic\venv\lib\site-packages\keras\engine\training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, validation_freq, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
   1716         ```
   1717         """
-> 1718         return training_generator.fit_generator(
   1719             self, generator,
   1720             steps_per_epoch=steps_per_epoch,

c:\users\offic\venv\lib\site-packages\keras\engine\training_generator.py in fit_generator(model, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, validation_freq, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
    215                 callbacks.on_batch_begin(batch_index, batch_logs)
    216 
--> 217                 outs = model.train_on_batch(x, y,
    218                                             sample_weight=sample_weight,
    219                                             class_weight=class_weight,

c:\users\offic\venv\lib\site-packages\keras\engine\training.py in train_on_batch(self, x, y, sample_weight, class_weight, reset_metrics)
   1512             ins = x + y + sample_weights
   1513         self._make_train_function()
-> 1514         outputs = self.train_function(ins)
   1515 
   1516         if reset_metrics:

c:\users\offic\venv\lib\site-packages\tensorflow\python\keras\backend.py in __call__(self, inputs)
   3629       self._make_callable(feed_arrays, feed_symbols, symbol_vals, session)
   3630 
-> 3631     fetched = self._callable_fn(*array_vals,
   3632                                 run_metadata=self.run_metadata)
   3633     self._call_fetch_callbacks(fetched[-len(self._fetches):])

c:\users\offic\venv\lib\site-packages\tensorflow\python\client\session.py in __call__(self, *args, **kwargs)
   1468       try:
   1469         run_metadata_ptr = tf_session.TF_NewBuffer() if run_metadata else None
-> 1470         ret = tf_session.TF_SessionRunCallable(self._session._session,
   1471                                                self._handle, args,
   1472                                                run_metadata_ptr)

FailedPreconditionError: 2 root error(s) found.
  (0) Failed precondition: Attempting to use uninitialized value yolo_layer_2/Variable
	 [[{{node yolo_layer_2/AssignAdd}}]]
	 [[loss/Identity_2/_5921]]
  (1) Failed precondition: Attempting to use uninitialized value yolo_layer_2/Variable
	 [[{{node yolo_layer_2/AssignAdd}}]]
0 successful operations.
0 derived errors ignored.

I have tried to change the behavior to v1, but in vain.

From what I'm able to make out, it is an orror in about the last line,

if __name__ == '__main__':
    argparser = argparse.ArgumentParser(description='train and evaluate YOLO_v3 model on any dataset')
    argparser.add_argument('-c', '--conf', help='path to configuration file')   

    args = argparser.parse_args()
    _main_(args)

Any guidance is appreciated

@leonilpark
Copy link

I had same error. Did you solved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants