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

Detect video with own model #90

Open
finaldzn opened this issue Nov 6, 2019 · 1 comment
Open

Detect video with own model #90

finaldzn opened this issue Nov 6, 2019 · 1 comment
Labels
training Training Related Questions

Comments

@finaldzn
Copy link

finaldzn commented Nov 6, 2019

Hello,
I trained my own model to detect queen bees.
I have a model already train. My model only has 1 class.
This is what i ran

python detect_video.py --video C:\Users\Victor\Videos\queenbees\Queen Bee-IOw5pu66vWY.mp4 --weights ./checkpoints/yolov3_train_10.tf  --size 416 --classes custom.names --tiny False

This is the error i got.

Traceback (most recent call last):
  File "detect_video.py", line 67, in <module>
    app.run(main)
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\absl\app.py", line 299, in run
    _run_main(main, args)
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\absl\app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "detect_video.py", line 26, in main
    yolo.load_weights(FLAGS.weights)
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 181, in load_weights
    return super(Model, self).load_weights(filepath, by_name)
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\keras\engine\network.py", line 1149, in load_weights
    status = self._trackable_saver.restore(filepath)
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\training\tracking\util.py", line 1270, in restore
    checkpoint=checkpoint, proto_id=0).restore(self._graph_view.root)
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\training\tracking\base.py", line 209, in restore
    restore_ops = trackable._restore_from_checkpoint_position(self)  # pylint: disable=protected-access
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\training\tracking\base.py", line 908, in _restore_from_checkpoint_position
    tensor_saveables, python_saveables))
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\training\tracking\util.py", line 289, in restore_saveables
    validated_saveables).restore(self.save_path_tensor)
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\training\saving\functional_saver.py", line 255, in restore
    restore_ops.update(saver.restore(file_prefix))
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\training\saving\functional_saver.py", line 102, in restore
    restored_tensors, restored_shapes=None)
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\training\saving\saveable_object_util.py", line 115, in restore
    self.handle_op, self._var_shape, restored_tensor)
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py", line 291, in shape_safe_assign_variable_handle
    shape.assert_is_compatible_with(value_tensor.shape)
  File "C:\Users\Victor\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\python\framework\tensor_shape.py", line 1115, in assert_is_compatible_with
    raise ValueError("Shapes %s and %s are incompatible" % (self, other))
ValueError: Shapes (3, 3, 3, 32) and (3, 3, 3, 16) are incompatible

Any help would be valued and if you need anything that would help me or you trying to fix this please ask.
Thank you

@WHBSmith
Copy link

WHBSmith commented Nov 7, 2019

Your trained weights are a different size from the network you're trying to load them into

@zzh8829 zzh8829 added the training Training Related Questions label Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
training Training Related Questions
Projects
None yet
Development

No branches or pull requests

3 participants