Open SigireddyBalasai opened 2 months ago
@glenn-jocher
@SigireddyBalasai it looks like the error is due to an issue with the model configuration file. Please ensure that your YAML file is correctly formatted and includes all necessary sections. If the problem persists, try updating to the latest version of the Ultralytics package. For further details, you can refer to the RT-DETR documentation.
@SigireddyBalasai The way that suggested yaml is formatted is wrong. There are resnet101 & resnet50 yaml's available here. Otherwise you need to look at the way the yaml's are formatted in the folder I linked.
THis is the config file
and i forked the latest version from github
i think the mew breaking changes that was done to layers also breaked this
backbone: resnet18
pretrained: true
This is not how a backbone is formatted. Please look at the correct yaml files on how to format a backbone. You can find them here.
This is a correct rtdetr-resnet50 yaml: https://github.com/ultralytics/ultralytics/blob/5dce4917e0ce01f18e25256c8082b7baac05120f/ultralytics/cfg/models/rt-detr/rtdetr-resnet50.yaml#L1-L42
How can I include pretraines weights
On Wed, Sep 4, 2024, 2:18 AM Skillnoob @.***> wrote:
backbone: resnet18 pretrained: true
This is not how a backbone is formatted. Please look at the correct yaml files on how to format a backbone. You can find them here https://github.com/ultralytics/ultralytics/tree/main/ultralytics/cfg/models/rt-detr .
This is a correct rtdetr-resnet50 yaml:
— Reply to this email directly, view it on GitHub https://github.com/ultralytics/ultralytics/issues/15980#issuecomment-2327410222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYHQ36PTGLZ4O37J6TMC423ZUYOCLAVCNFSM6AAAAABNRZFLV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRXGQYTAMRSGI . You are receiving this because you were mentioned.Message ID: @.***>
@SigireddyBalasai for a custom model, you can't. Unless you already have trained a coco model using your yaml, where then you'd only have to load that model when wanting to train. You can't just generate pretrained weights out of thin air.
but every backbone should have pretrained weights
and we have weights for every backbone lying everywhere
Please ensure your YAML configuration file is correctly formatted and includes the necessary sections. For pretrained weights, you can specify the path to the weights file in the YAML configuration. If the issue persists, please verify with the latest package version.
can you please give me example of an correct yaml file with some pretrained backbone like mobilenet or resnet18 etc @glenn-jocher
@SigireddyBalasai Can you please actually listen to me?
What you are asking here is unreasonable and you should please read up on how these things actually work.
Ok, thanks for the clarification.
On Wed, Sep 4, 2024, 5:07 PM Skillnoob @.***> wrote:
@SigireddyBalasai https://github.com/SigireddyBalasai Can you please actually listen to me?
- There are no "backbone" weights. That just doesn't exist.
- Its a custom yaml. You cannot create a pretrained weight without actually training it.
- We are not here to send you pretrained weights.
- I have already sent you a correct resnet yaml, use that to train your model
What you are asking here is unreasonable and you should please read up on how these things actually work.
— Reply to this email directly, view it on GitHub https://github.com/ultralytics/ultralytics/issues/15980#issuecomment-2328711466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYHQ36IYPG4CYBQEFZAQN2DZU3WJBAVCNFSM6AAAAABNRZFLV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRYG4YTCNBWGY . You are receiving this because you were mentioned.Message ID: @.***>
if possible can you give me resources where i can learn how to create similar yaml files for custom model @Skillnoob
@SigireddyBalasai you can look at the existing yaml files on how to format them correctly and I have already linked resnet rtdetr yaml's earlier.
Thanks, I'll check them out.
On Wed, Sep 4, 2024, 5:20 PM Skillnoob @.***> wrote:
@SigireddyBalasai https://github.com/SigireddyBalasai you can look at the existing yaml files on how to format them correctly and I have already linked resnet rtdetr yaml's earlier.
— Reply to this email directly, view it on GitHub https://github.com/ultralytics/ultralytics/issues/15980#issuecomment-2328747319, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYHQ36PUARR5AAE7YA3LMHLZU3XXPAVCNFSM6AAAAABNRZFLV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRYG42DOMZRHE . You are receiving this because you were mentioned.Message ID: @.***>
You're welcome! If you have any more questions, feel free to ask.
Thank you for your question. Currently, the RT-DETR models provided in the Ultralytics repository do not include configurations for ResNet18 and ResNet34. The available configurations are designed to balance performance and efficiency for a variety of use cases, but we understand the need for more lightweight options.
If you are looking to create a custom configuration with ResNet18 or ResNet34, you can modify the existing YAML configuration files to use these backbones. Here’s a brief guide on how you can do this:
cfg
directory where the model configuration files are located.rtdetr.yaml
) and rename it (e.g.,rtdetr_resnet18.yaml
).Here’s an example of how you might modify the backbone section:
This approach allows you to experiment with different backbones and find the optimal balance between model size and performance for your specific application.
If you encounter any issues or need further assistance, please provide a minimum reproducible example as outlined here. This will help us better understand your setup and provide more targeted support.
Happy experimenting! 🚀
Originally posted by @glenn-jocher in https://github.com/ultralytics/ultralytics/issues/13901#issuecomment-2188488885
File /opt/conda/lib/python3.10/site-packages/ultralytics/models/rtdetr/model.py:37, in RTDETR.init(self, model) 27 def init(self, model="rtdetr-l.pt") -> None: 28 """ 29 Initializes the RT-DETR model with the given pre-trained model file. Supports .pt and .yaml formats. 30 (...) 35 NotImplementedError: If the model file extension is not 'pt', 'yaml', or 'yml'. 36 """ ---> 37 super().init(model=model, task="detect")
File /opt/conda/lib/python3.10/site-packages/ultralytics/engine/model.py:143, in Model.init(self, model, task, verbose) 141 # Load or create new YOLO model 142 if Path(model).suffix in {".yaml", ".yml"}: --> 143 self._new(model, task=task, verbose=verbose) 144 else: 145 self._load(model, task=task)
File /opt/conda/lib/python3.10/site-packages/ultralytics/engine/model.py:263, in Model._new(self, cfg, task, model, verbose) 261 self.cfg = cfg 262 self.task = task or guess_model_task(cfg_dict) --> 263 self.model = (model or self._smart_load("model"))(cfg_dict, verbose=verbose and RANK == -1) # build model 264 self.overrides["model"] = self.cfg 265 self.overrides["task"] = self.task
File /opt/conda/lib/python3.10/site-packages/ultralytics/nn/tasks.py:511, in RTDETRDetectionModel.init(self, cfg, ch, nc, verbose) 501 def init(self, cfg="rtdetr-l.yaml", ch=3, nc=None, verbose=True): 502 """ 503 Initialize the RTDETRDetectionModel. 504 (...) 509 verbose (bool, optional): Print additional information during initialization. Defaults to True. 510 """ --> 511 super().init(cfg=cfg, ch=ch, nc=nc, verbose=verbose)
File /opt/conda/lib/python3.10/site-packages/ultralytics/nn/tasks.py:302, in DetectionModel.init(self, cfg, ch, nc, verbose) 300 super().init() 301 self.yaml = cfg if isinstance(cfg, dict) else yaml_model_load(cfg) # cfg dict --> 302 if self.yaml["backbone"][0][2] == "Silence": 303 LOGGER.warning( 304 "WARNING ⚠️ YOLOv9
Silence
module is deprecated in favor of nn.Identity. " 305 "Please delete local *.pt file and re-download the latest model checkpoint." 306 ) 307 self.yaml["backbone"][0][2] = "nn.Identity"KeyError: 0
could you please clarify this