Closed shshrzad closed 11 months ago
Can you provide the training command you using? Actually the coco_train_script.py
with yolov8
is not tested...
Sure. It was the code that I used. "CUDA_VISIBLE_DEVICES='0' ./coco_train_script.py --det_header yolov8.YOLOV8_M --backbone iformer.IFormerSmall --freeze_backbone_epochs 0 --batch_size 4 -A anchor_free -e 200 -i 512 --summary store_true -d /home/shahrzad/miniconda3/envs/sr-det/keras_cv_attention_models-main_original/train_val_768.json --use_l1_loss store_true "
and the error is:
"
Epoch 1/200
Traceback (most recent call last):
File
"/home/shahrzad/miniconda3/envs/sr-det/keras_cv_attention_models-main_yolo8/./coco_train_script.py",
line 299, in
File
"/home/shahrzad/miniconda3/envs/sr-det/lib/python3.9/site-packages/keras/engine/training.py", line 1249, in train_function return step_function(self, iterator) File "/home/shahrzad/miniconda3/envs/sr-det/keras_cv_attention_models-main_yolo8/keras_cv_attention_models/coco/losses.py", line 280, in call class_loss, bbox_loss, object_loss, l1_loss, dfl_loss, num_valid, class_acc = tf.map_fn( File "/home/shahrzad/miniconda3/envs/sr-det/keras_cv_attention_models-main_yolo8/keras_cv_attention_models/coco/losses.py", line 270, in call_single__ * lambda: (0.0, 0.0, tf.reduce_sum(K.binary_crossentropy(0.0, bbox_labels_pred[:, -1])), 0.0, 0.0, 0.0, 0.0), # Object loss only, target is all False File "/home/shahrzad/miniconda3/envs/sr-det/keras_cv_attention_models-main_yolo8/keras_cv_attention_models/coco/losses.py", line 227, in valid_call_single__ bbox_labels_true_assined = tf.stop_gradient(self.anchor_assign(bbox_labels_true, bbox_labels_pred)) File "/home/shahrzad/miniconda3/envs/sr-det/keras_cv_attention_models-main_yolo8/keras_cv_attention_models/coco/anchors_func.py", line 570, in call cls_loss = K.binary_crossentropy(tf.expand_dims(labels_true, 1), tf.expand_dims(obj_labels_pred, 0)) # [num_bboxes, num_picked_anchors, num_classes] File "/home/shahrzad/miniconda3/envs/sr-det/lib/python3.9/site-packages/keras/backend.py", line 5688, in binary_crossentropy bce = target * tf.math.log(output + epsilon())
ValueError: Dimensions must be equal, but are 6 and 66 for '{{node
AnchorFreeLoss/map/while/cond/mul_8}} = MulT=DT_FLOAT' with input shapes: [?,1,6], [1,?,66]. "
On Wed, Jun 28, 2023 at 4:54 PM leondgarse @.***> wrote:
Can you provide the training command you using? Actually the coco_train_script.py with yolov8 is not tested...
— Reply to this email directly, view it on GitHub https://github.com/leondgarse/keras_cv_attention_models/issues/124#issuecomment-1611408421, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMHD5FXNGPPQ7AMFRUDIH6DXNQWCVANCNFSM6AAAAAAZWU4B7A . You are receiving this because you authored the thread.Message ID: @.***>
This should be fixed, basic test in colab kecam_coco_tiny_test.ipynb. But still, the training performance cannot be guaranteed...
Thank you for your consideration.
Yes, I tested the code. It run without any errors but I think its performance isn't still reliable.
On Fri, Jun 30, 2023, 17:57 leondgarse @.***> wrote:
This should be fixed, basic test in colab kecam_coco_tiny_test.ipynb https://colab.research.google.com/drive/1m8exC3Jh9_gT8Ey5IKfoYRclfcLUf_rw?usp=drive_link. But still, the training performance cannot be guaranteed...
— Reply to this email directly, view it on GitHub https://github.com/leondgarse/keras_cv_attention_models/issues/124#issuecomment-1614735418, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMHD5FSQI42IJHVZDAFNML3XN3O53ANCNFSM6AAAAAAZWU4B7A . You are receiving this because you authored the thread.Message ID: @.***>
Actually, in most times my trying with coco training, using Tensorflow cannot match with original PyTorch one in both speed and performance. Thus I'm considering training using PyTorch only, and I have to say, this coco_train_script.py
havn't been tested for a long time...
Thank you for your explanation. Do you think if I train my YOLOv8 model with anchor-free anchor mode in tensorflow framework, I may have incorrect results? What is your recommendation now?
At least in my implementation it's not as good as pytorch one. You may also refer keras-cv implementations YOLOV8 for Object Detection. I've updated a little longer training in colab kecam_coco_tiny_test.ipynb, which shows a resonable result. It's just some hyper parameters and dataset detail not set as pytorch one, and you have to try it out by yourself... So my recommendation is still the original pytorch one. Currently mine is still under testing and developing.
Thanks for the tip!
On Sun, Jul 2, 2023, 11:52 leondgarse @.***> wrote:
At least in my implementation it's not as good as pytorch one. You may also refer keras-cv implementations YOLOV8 for Object Detection https://github.com/keras-team/keras-cv/pull/1711. I've updated a little longer training in colab kecam_coco_tiny_test.ipynb https://colab.research.google.com/drive/1m8exC3Jh9_gT8Ey5IKfoYRclfcLUf_rw?usp=drive_link, which shows a resonable result. It's just some hyper parameters and dataset detail not set as pytorch one, and you have to try it out by yourself... So my recommendation is still the original pytorch one. Currently mine is still under testing and developing.
— Reply to this email directly, view it on GitHub https://github.com/leondgarse/keras_cv_attention_models/issues/124#issuecomment-1616438519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMHD5FTMUET5DPLGZIWQE3DXOEVUJANCNFSM6AAAAAAZWU4B7A . You are receiving this because you authored the thread.Message ID: @.***>
When I want to train yolov8 with considering anchor-free anchor mode an error corresponds with dimensions occurs. How can I solve this problem?