ultralytics / hub

Ultralytics HUB tutorials and support
https://hub.ultralytics.com
GNU Affero General Public License v3.0
138 stars 14 forks source link

Can't Resume Training Since YOLOv8 Update #198

Closed MorcretteApside closed 1 year ago

MorcretteApside commented 1 year ago

Search before asking

HUB Component

Training

Bug

Hi,

I have train my datasets yesterday and it worked, but today it doesnt work anymore, the code from google colab change a little. I tried training from python script but i have a error from numpy : AttributeError: module 'numpy' has no attribute 'object'. np.object was a deprecated alias for the builtin object. To avoid this error in existing code, use object by itself. Doing this will not modify any behavior and is safe. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Environment

Minimal Reproducible Example

No response

Additional

image

github-actions[bot] commented 1 year ago

👋 Hello @MorcretteApside, thank you for raising an issue about Ultralytics HUB 🚀! Please visit our HUB Docs to learn more, and see our ⭐️ HUB Guidelines to quickly get started uploading datasets and training YOLO models.

If this is a 🐛 Bug Report, please provide screenshots and steps to recreate your problem to help us get started working on a fix.

If this is a ❓ Question, please provide as much information as possible, including dataset, model, environment details etc. so that we might provide the most helpful response.

We try to respond to all issues as promptly as possible. Thank you for your patience!

kalenmike commented 1 year ago

@MorcretteApside Thanks for raising this. Yesterday evening we migrated HUB over to YOLOv8. Our Colab notebook is now setup to train YOLOv5u and YOLOv8 models. You will not be able to resume training a previously created YOLOv5 model with the new Colab notebook.

To resume training your YOLOv5 model you can create your own Colab notebook or use a local agent. Here is the how to get it done:

pip install -U ultralytics==0.0.44
import ultralytics
ultralytics.start('APIKEY_MODELID')

With YOLOv8 we have split the API Key and the model ID. To train YOLOv5 you will need to join your API Key and the model Id with an underscore. e.g.

56987c38ds0f2e9c0073a09108a5718833e32be7663_R6nMlK6kQjSsQ76MPqQM

You can find both of these in the sample code given when creating a new model or you can get your API Key from

https://hub.ultralytics.com/settings?tab=api+keys

and you can get the model id from the last part of the URL when navigating to it with HUB. In this example the model id is R6nMlK6kQjSsQ76MPqQM

https://hub.ultralytics.com/models/R6nMlK6kQjSsQ76MPqQM

MorcretteApside commented 1 year ago

i have now this error when i try to train yolov8 : Ultralytics HUB: Authenticated ✅

ModuleNotFoundError Traceback (most recent call last) in <cell line: 3>() 1 hub.login('01bb34f75c78679f14a660be4cd76cb61258fc7361') 2 ----> 3 model = YOLO('https://hub.ultralytics.com/models/4Hzo5d5rZWM1EALCsdRs') 4 5 model.train()

/usr/local/lib/python3.9/dist-packages/ultralytics/yolo/engine/model.py in init(self, model, task)

ModuleNotFoundError: No module named 'ultralytics.hub.session'


NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the "Open Examples" button below.

kalenmike commented 1 year ago

@MorcretteApside In your output above it looks like you do not have the correct ultralytics package installed. For YOLOv8 make sure you are running the latest ultralytics package.

pip install -U ultralytics

MorcretteApside commented 1 year ago

i have still an error

Ultralytics HUB: Authenticated ✅ Ultralytics HUB: Authenticated ✅ Ultralytics HUB: View model at https://hub.ultralytics.com/models/W0q3Td73VlzaW8Vq66ko 🚀 Ultralytics HUB: 0.013 GB dataset, 54.9/78.2 GB free disk space Ultralytics YOLOv8.0.66 🚀 Python-3.9.16 torch-2.0.0+cu118 CUDA:0 (Tesla T4, 15102MiB) yolo/engine/trainer: task=detect, mode=train, model=yolov8n.pt, data=https://storage.googleapis.com/ultralytics-hub.appspot.com/users/ar6XkxbDnWgy2sF00TPoIEPRRxy2/datasets/7EUg8EiXSfzoaf9woOFh/Drone.v2i.yolov8.zip?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=firebase-adminsdk-jsjt9%40ultralytics-hub.iam.gserviceaccount.com%2F20230406%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20230406T123639Z&X-Goog-Expires=900&X-Goog-SignedHeaders=host&X-Goog-Signature=884110101a31ecc9a2eb5a0d369e29fa4bf57c6fa3b44c6d3028f6718670a3b570ed845764ce03c1c7b821a1ce12bb37dcafe53da09a8a42e24580ad0de0780334aa24f9e9c0ece22777b8dc3d64c4cf45ac7fe49f0cb097a1881e07530a17a5849fc01cbb7566a970847c60180ffac388a8fe0ceae9053dd632682b70b3f424ed56aadee11785720a6fe5413915578e8e9138a1623cf3f2d040299e70304a94a238c54d83a4ace924d341a65f3523b095fae71983be39cdcb1ad2f979da880ea1fca3ad4451c842785fc5ca3b143ad0885a5eb1774f53a14cf002760b9c9f96d7330a4be90eadab173ac9c694e1d99ac08d170c5327dafb1449f5ecf74fe847, epochs=100, patience=100, batch=-1, imgsz=640, save=True, save_period=-1, cache=ram, device=, workers=8, project=None, name=None, exist_ok=False, pretrained=False, optimizer=SGD, verbose=True, seed=0, deterministic=True, single_cls=False, image_weights=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, amp=True, overlap_mask=True, mask_ratio=4, dropout=0.0, val=True, split=val, save_json=False, save_hybrid=False, conf=None, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=None, show=False, save_txt=False, save_conf=False, save_crop=False, show_labels=True, show_conf=True, vid_stride=1, line_thickness=3, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, boxes=True, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=None, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, pose=12.0, kobj=1.0, fl_gamma=0.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0, cfg=None, v5loader=False, tracker=botsort.yaml, save_dir=runs/detect/train2 Downloading https://storage.googleapis.com/ultralytics-hub.appspot.com/users/ar6XkxbDnWgy2sF00TPoIEPRRxy2/datasets/7EUg8EiXSfzoaf9woOFh/Drone.v2i.yolov8.zip?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=firebase-adminsdk-jsjt9%40ultralytics-hub.iam.gserviceaccount.com%2F20230406%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20230406T123639Z&X-Goog-Expires=900&X-Goog-SignedHeaders=host&X-Goog-Signature=884110101a31ecc9a2eb5a0d369e29fa4bf57c6fa3b44c6d3028f6718670a3b570ed845764ce03c1c7b821a1ce12bb37dcafe53da09a8a42e24580ad0de0780334aa24f9e9c0ece22777b8dc3d64c4cf45ac7fe49f0cb097a1881e07530a17a5849fc01cbb7566a970847c60180ffac388a8fe0ceae9053dd632682b70b3f424ed56aadee11785720a6fe5413915578e8e9138a1623cf3f2d040299e70304a94a238c54d83a4ace924d341a65f3523b095fae71983be39cdcb1ad2f979da880ea1fca3ad4451c842785fc5ca3b143ad0885a5eb1774f53a14cf002760b9c9f96d7330a4be90eadab173ac9c694e1d99ac08d170c5327dafb1449f5ecf74fe847 to Drone.v2i.yolov8.zip... 100%|██████████| 12.9M/12.9M [00:02<00:00, 4.64MB/s] Unzipping Drone.v2i.yolov8.zip to /content/datasets...

StopIteration Traceback (most recent call last) /usr/local/lib/python3.9/dist-packages/ultralytics/yolo/engine/trainer.py in init(self, cfg, overrides) 122 elif self.args.data.endswith('.yaml') or self.args.task in ('detect', 'segment'): --> 123 self.data = check_det_dataset(self.args.data) 124 if 'yaml_file' in self.data:

3 frames StopIteration: The above exception was the direct cause of the following exception: RuntimeError Traceback (most recent call last) /usr/local/lib/python3.9/dist-packages/ultralytics/yolo/engine/trainer.py in init(self, cfg, overrides) 125 self.args.data = self.data['yaml_file'] # for validating 'yolo train data=url.zip' usage 126 except Exception as e: --> 127 raise RuntimeError(emojis(f"Dataset '{self.args.data}' error ❌ {e}")) from e 128 129 self.trainset, self.testset = self.get_dataset(self.data)

RuntimeError: Dataset 'https://storage.googleapis.com/ultralytics-hub.appspot.com/users/ar6XkxbDnWgy2sF00TPoIEPRRxy2/datasets/7EUg8EiXSfzoaf9woOFh/Drone.v2i.yolov8.zip?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=firebase-adminsdk-jsjt9%40ultralytics-hub.iam.gserviceaccount.com%2F20230406%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20230406T123639Z&X-Goog-Expires=900&X-Goog-SignedHeaders=host&X-Goog-Signature=884110101a31ecc9a2eb5a0d369e29fa4bf57c6fa3b44c6d3028f6718670a3b570ed845764ce03c1c7b821a1ce12bb37dcafe53da09a8a42e24580ad0de0780334aa24f9e9c0ece22777b8dc3d64c4cf45ac7fe49f0cb097a1881e07530a17a5849fc01cbb7566a970847c60180ffac388a8fe0ceae9053dd632682b70b3f424ed56aadee11785720a6fe5413915578e8e9138a1623cf3f2d040299e70304a94a238c54d83a4ace924d341a65f3523b095fae71983be39cdcb1ad2f979da880ea1fca3ad4451c842785fc5ca3b143ad0885a5eb1774f53a14cf002760b9c9f96d7330a4be90eadab173ac9c694e1d99ac08d170c5327dafb1449f5ecf74fe847' error ❌

kalenmike commented 1 year ago

@MorcretteApside Is this the first time you are using this dataset? Or have you used this dataset to train a model successfully before?

MorcretteApside commented 1 year ago

i've trained a model with this one before (but on yolo v5) never on yolov8

glenn-jocher commented 1 year ago

@MorcretteApside thank you for letting us know about this bug!

I took a look at your screenshot and this seems to be related to #199 and #201, which we just pushed a fix for in https://github.com/ultralytics/ultralytics/pull/1871. This fix is live in ultralytics 8.0.67 now. Please update your ultraltyics package with pip install -U ultralytics and try to train again.

Let us know if this resolves your issue, and feel free to tell us of any other ideas or problems you find!

MorcretteApside commented 1 year ago

it works thank you very much

UltralyticsAssistant commented 1 year ago

@MorcretteApside you're welcome! I'm glad to hear that your issue has been resolved. If you have any more questions or run into other issues in the future, don't hesitate to reach out. Happy training with YOLOv8!