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

Training Model.fit - BaseCollectiveExecutor::StartAbort Out of range: End of sequence #144

Open
brianhildebrandt opened this issue Jan 6, 2020 · 6 comments

Comments

@brianhildebrandt
Copy link

This issue was posted and closed recently however there is no clear resolution for me to follow. I've tried training with VOC and COCO datasets compiled appropriately into TFRecord datasets. I've used the visualize tools recently posted (most helpful) to validate my TFRecord entries.
I am running TF 2.0
CUDA 10.1.243
cuDNN 7.6.5
python 3.7.0
Ubuntu 18.04 LTS
NVIDIA TITAN RTX
python train.py --dataset=../COCO/images/train.tfrecord --val_dataset=../COCO/images/test.tfrecord --weights=./checkpoints/yolov3.tf --classes=../COCO/images/coco.names --mode=fit --transfer=darknet --epochs=2 --num_classes=80
I get these errors at the end of each epoch ...
tensorflow/core/common_runtime/base_collective_executor.cc:216] BaseCollectiveExecutor::StartAbort Out of range: End of sequence
[[{{node IteratorGetNext}}]]
2020-01-05 18:27:37.863969: W tensorflow/core/common_runtime/base_collective_executor.cc:216] BaseCollectiveExecutor::StartAbort Out of range: End of sequence
[[{{node IteratorGetNext}}]]
[[Shape/_10]]
2020-01-05 18:30:26.995630: W tensorflow/core/common_runtime/base_collective_executor.cc:216] BaseCollectiveExecutor::StartAbort Out of range: End of sequence
[[{{node IteratorGetNext}}]]
[[IteratorGetNext/_2]]
2020-01-05 18:30:26.995689: W tensorflow/core/common_runtime/base_collective_executor.cc:216] BaseCollectiveExecutor::StartAbort Out of range: End of sequence
[[{{node IteratorGetNext}}]]

My loss calculations look fine but training results in no detection.
I've tried --transfer=darknet and get the same errors PLUS unresolved errors as follows ... WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-8
W0105 19:28:00.213585 139785603508032 util.py:144] Unresolved object in checkpoint: (root).layer-8

In the previous post the final comment was "random weights not recommended". I am not able to interpret what this means with respect to the training parameters or inputs. How can I solve this issue? Any thoughts on what could be the cause?

@brianhildebrandt
Copy link
Author

Reading your tutorial you encourage the use of transfer from darknet as opposed to none. Does this mean that I should avoid overlapping classes from my training dataset and darknet or will they merge?

@zzh8829
Copy link
Owner

zzh8829 commented Jan 6, 2020

the out of range error shouldn't affect training tensorflow/tensorflow#31509

regarding transfer learning:
yolov3 is composed of darknet feature extractor and object detector. darknet transfer has almost nothing to do with classes, they are two different part of the network. Training with random weights without darknet will cause overfitting issue, the reason is feature extractor won't converge properly.

now for your issue its hard to tell without context of your dataset. Are you just training with raw coco or some custom images? Can you share the number of images/classes in your dataset and your loss output?

@brianhildebrandt
Copy link
Author

Thanks. I better understand it now. So the Darknet weights are being applied to the network before we begin training. Much clearer. I am running the same training data (COCO) with --transfer=darknet and --mode=eager_fit and I am not getting any errors at all. I am running 20 epoch and it will be at least tomorrow before it finishes so I don't know yet how well the results will work in detection. I will try again to run with --mode=fit after while continuing to use the transfer with darknet weights.
Thank you for all your hard work on this. I am very impressed with your project and look forward to many hours of learning from it. I hope to be able to contribute to the advancement of these types of projects in the near future.

@brianhildebrandt
Copy link
Author

Completed 20 epochs of training on the COCO data. No errors until the end at which I got this ...
Epoch 00020: saving model to checkpoints/yolov3_train_20.tf
14659/14659 [==============================] - 7483s 510ms/step - loss: 14.4918 - yolo_output_0_loss: 2.3048 - yolo_output_1_loss: 2.0976 - yolo_output_2_loss: 2.5082 - val_loss: 13.8473 - val_yolo_output_0_loss: 3.0016 - val_yolo_output_1_loss: 1.9694 - val_yolo_output_2_loss: 1.2882
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-8
W0107 16:15:24.741643 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-8
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-9
W0107 16:15:24.741811 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-9
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-10
W0107 16:15:24.741863 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-10
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-11
W0107 16:15:24.741909 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-11
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-8.arguments
W0107 16:15:24.741968 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-8.arguments
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-8._variable_dict
W0107 16:15:24.742013 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-8._variable_dict
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-8._trainable_weights
W0107 16:15:24.742055 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-8._trainable_weights
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-8._non_trainable_weights
W0107 16:15:24.742096 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-8._non_trainable_weights
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-9.arguments
W0107 16:15:24.742136 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-9.arguments
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-9._variable_dict
W0107 16:15:24.742177 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-9._variable_dict
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-9._trainable_weights
W0107 16:15:24.742217 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-9._trainable_weights
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-9._non_trainable_weights
W0107 16:15:24.742257 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-9._non_trainable_weights
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-10.arguments
W0107 16:15:24.742296 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-10.arguments
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-10._variable_dict
W0107 16:15:24.742336 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-10._variable_dict
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-10._trainable_weights
W0107 16:15:24.742375 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-10._trainable_weights
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-10._non_trainable_weights
W0107 16:15:24.742415 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-10._non_trainable_weights
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-11.arguments
W0107 16:15:24.742454 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-11.arguments
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-11._variable_dict
W0107 16:15:24.742492 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-11._variable_dict
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-11._trainable_weights
W0107 16:15:24.742532 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-11._trainable_weights
WARNING:tensorflow:Unresolved object in checkpoint: (root).layer-11._non_trainable_weights
W0107 16:15:24.742571 139847340382016 util.py:144] Unresolved object in checkpoint: (root).layer-11._non_trainable_weights
WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/alpha/guide/checkpoints#loading_mechanics for details.
W0107 16:15:24.742649 139847340382016 util.py:152] A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/alpha/guide/checkpoints#loading_mechanics for details

When I try to run detect_video.py referencing the last epoch checkpoint for weights I get similar errors as follows;
2020-01-07 19:28:28.487992: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 22601 MB memory) -> physical GPU (device: 0, name: TITAN RTX, pci bus id: 0000:09:00.0, compute capability: 7.5)
I0107 19:28:33.591755 139925371156288 detect_video.py:36] weights loaded
I0107 19:28:33.606082 139925371156288 detect_video.py:39] classes loaded
2020-01-07 19:28:38.828907: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
Traceback (most recent call last):
File "detect_video.py", line 90, in
app.run(main)
File "/home/brian/anaconda3/envs/yolov3-tf2/lib/python3.7/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/brian/anaconda3/envs/yolov3-tf2/lib/python3.7/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "detect_video.py", line 81, in main
cv2.imshow('output', img)
cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/highgui/src/window.cpp:632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer
W0107 19:28:40.745351 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.iter
W0107 19:28:40.745522 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer.iter
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_1
W0107 19:28:40.745578 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer.beta_1
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.beta_2
W0107 19:28:40.745632 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer.beta_2
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.decay
W0107 19:28:40.745682 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer.decay
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer.learning_rate
W0107 19:28:40.745728 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer.learning_rate
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-0.kernel
W0107 19:28:40.745811 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-0.kernel
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-1.gamma
W0107 19:28:40.745860 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-1.gamma
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-1.beta
W0107 19:28:40.745906 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-1.beta
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-2.kernel
W0107 19:28:40.745954 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-2.kernel
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-3.gamma
W0107 19:28:40.746000 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-3.gamma
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-3.beta
W0107 19:28:40.746048 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-3.beta
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-4.kernel
W0107 19:28:40.746094 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-4.kernel
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-5.gamma
W0107 19:28:40.746140 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-5.gamma
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-5.beta
W0107 19:28:40.746186 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-5.beta
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-6.kernel
W0107 19:28:40.746232 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-6.kernel
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-7.gamma
W0107 19:28:40.746277 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-7.gamma
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-7.beta
W0107 19:28:40.746326 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-7.beta
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-8.kernel
W0107 19:28:40.746372 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-8.kernel
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-9.gamma
W0107 19:28:40.746418 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-9.gamma
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-9.beta
W0107 19:28:40.746464 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-1.layer_with_weights-9.beta
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-2.layer_with_weights-0.kernel
W0107 19:28:40.746509 139925371156288 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-2.layer_with_weights-0.kernel
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-2.layer_with_weights-1.gamma

Any idea what I am doing wrong?
Thanks in advance for any advice.

@brianhildebrandt
Copy link
Author

the out of range error shouldn't affect training tensorflow/tensorflow#31509

regarding transfer learning:
yolov3 is composed of darknet feature extractor and object detector. darknet transfer has almost nothing to do with classes, they are two different part of the network. Training with random weights without darknet will cause overfitting issue, the reason is feature extractor won't converge properly.

now for your issue its hard to tell without context of your dataset. Are you just training with raw coco or some custom images? Can you share the number of images/classes in your dataset and your loss output?

I apologize as I overlooked your reuests. I will shrink the tfrecord and collect my loss output and provide it for your reference as soon as I am back in the office.

@krxat
Copy link
Contributor

krxat commented Mar 5, 2020

Any update on this?

One reason I thought that it could be possible for this error is that your total number of images is not divisible by your batch size. For example, if your dataset has 1005 images and 8 as batch size, the last batch will only have 5 images. @zzh8829 ?

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

3 participants