leondgarse / keras_cv_attention_models

Keras beit,caformer,CMT,CoAtNet,convnext,davit,dino,efficientdet,edgenext,efficientformer,efficientnet,eva,fasternet,fastervit,fastvit,flexivit,gcvit,ghostnet,gpvit,hornet,hiera,iformer,inceptionnext,lcnet,levit,maxvit,mobilevit,moganet,nat,nfnets,pvt,swin,tinynet,tinyvit,uniformer,volo,vanillanet,yolor,yolov7,yolov8,yolox,gpt2,llama2, alias kecam
MIT License
587 stars 92 forks source link

Shapes dont match if resolution other than default 640 #164

Open elicz opened 1 month ago

elicz commented 1 month ago

Change from: compute_loss = torch_losses.Loss(device=device, nc=num_classes)

to compute_loss = torch_losses.Loss(device=device, nc=num_classes, input_shape=imgsz)

https://github.com/leondgarse/keras_cv_attention_models/blob/9ee3d734e29efc5efd1a72d2304a1f05cb53f061/keras_cv_attention_models/yolov8/train.py#L79

(I was using EfficientNet backbone, resolution of inputs 320x320, and keras backend - shapes mismatched in loss function)

leondgarse commented 1 month ago

Ya, you are right. Fix is updated. It's actually updated in torch_coco_train_script.py, but missed here.