ultralytics / yolov3

YOLOv3 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
10.22k stars 3.45k forks source link

no anchor_grid in V9.6.0 yolov3.pt #2127

Closed zhoujiawei3 closed 10 months ago

zhoujiawei3 commented 1 year ago

Search before asking

Question

image why this happen?model .yaml is from yolov3.pt too

Additional

No response

github-actions[bot] commented 1 year ago

👋 Hello @zhoujiawei3, thank you for your interest in YOLOv3 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Requirements

Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:

git clone https://github.com/ultralytics/yolov3  # clone
cd yolov3
pip install -r requirements.txt  # install

Environments

YOLOv3 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

YOLOv3 CI

If this badge is green, all YOLOv3 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv3 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Introducing YOLOv8 🚀

We're excited to announce the launch of our latest state-of-the-art (SOTA) object detection model for 2023 - YOLOv8 🚀!

Designed to be fast, accurate, and easy to use, YOLOv8 is an ideal choice for a wide range of object detection, image segmentation and image classification tasks. With YOLOv8, you'll be able to quickly and accurately detect objects in real-time, streamline your workflows, and achieve new levels of accuracy in your projects.

Check out our YOLOv8 Docs for details and get started with:

pip install ultralytics
glenn-jocher commented 1 year ago

@zhoujiawei3 this issue may occur if you are using a newer version of YOLOv3 (v9.6.0), but your model weights file (yolov3.pt) is from an older version. The no anchor_grid error suggests that the model structure has changed between the versions.

To resolve this issue, you can try one of the following:

  1. Use the compatible version of the model weights file (yolov3.pt) that matches your YOLOv3 version (v9.6.0 in this case). Make sure the model weights file is from the same release or commit as the version you are currently using.

  2. Train the model using the new version (v9.6.0) with your own dataset. This ensures that the model weights and structure are consistent.

If you have any further questions or need assistance, please don't hesitate to ask. The YOLO community and the Ultralytics team are here to help!

zhoujiawei3 commented 1 year ago

ckpt = torch.load(weights, map_location=device) # load checkpoint model = Model(opt.cfg or ckpt['model'].yaml, ch=3, nc=nc, anchors=hyp.get('anchors')).to(device) # create exclude = ['anchor'] if (opt.cfg or hyp.get('anchors')) and not resume else [] # exclude keys csd = ckpt['model'].float().state_dict() # checkpoint state_dict as FP32 csd = intersect_dicts(csd, model.state_dict(), exclude=exclude) # intersect model.load_state_dict(csd, strict=False) # load logger.info(f'Transferred {len(csd)}/{len(model.state_dict())} items from {weights}') # report

The code to load checkpoint is from Yolov3.9.6,my opt.cfg is empty image still 439/440

glenn-jocher commented 1 year ago

Hi there! It seems that when loading the checkpoint using YOLOv3 version 9.6, the model is still showing 439 out of 440 items. This could be due to the mismatch between the checkpoint and the model state, possibly caused by differences in the model architecture or configurations.

To troubleshoot this, you can ensure that the checkpoint matches the exact architecture and configurations of the model, or you may need to adjust the loading process to handle any discrepancies between the checkpoint and the model state.

If you have any further questions or need additional assistance, feel free to ask. We're here to help!

github-actions[bot] commented 11 months ago

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO 🚀 and Vision AI ⭐