ryouchinsa / Rectlabel-support

RectLabel is an offline image annotation tool for object detection and segmentation.
https://rectlabel.com
515 stars 73 forks source link

CoreML failing to load #234

Closed CodeCutterUK closed 1 year ago

CodeCutterUK commented 1 year ago

When trying to load a Yolov8 model, converted to CoreML, I get this error.

compiler error: compiler error: Encountered an error while compiling a neural network model: Failed to copy weights during compilation. Error description: “weights” couldn’t be copied because you don’t have permission to access “model0”.

image

Additionally I get a "Create folder error" on app launch with the extra text "The file “settings” doesn’t exist."

It loaded the model once, so not sure it's an issue with the model.

I've attempt to remove the app and completely clear up, before reinstalling....but not sure I was able to find everything left behind.

Any suggestions?

ryouchinsa commented 1 year ago

Thanks for writing the issue.

When you launch RectLabel, RectLabel tries to read the settings file. ~/Library/Containers/com.waysify.roi/Data/settings_labels.json

Based on the error dialog, it might be that RectLabel does not have enough permission to read/write on your computer.

Coud you check the permission of RectLabel app?

CodeCutterUK commented 1 year ago

Thanks for looking at this

The directory is 700 and the file is 644. Setting both to 777 makes no difference. All files/dirs owned by my user.

ryouchinsa commented 1 year ago

We exported the coreml model using the latest YOLOv8. pip install ultralytics yolo segment export model=yolov8n-seg.pt format=coreml

In our environment we could load the coreml model without an error. Could you give us a hint to reproduce the problem in our environment?

CodeCutterUK commented 1 year ago

That's the same command I used. Obviously have to get access to the model inside the mlpackage, so that could be the issue.

It does feel like there is a permission issue. I'd be happy to set up a time to Zoom and show you the issue if that would work for you.

Optics commented 1 year ago

We exported the coreml model using the latest YOLOv8. pip install ultralytics yolo segment export model=yolov8n-seg.pt format=coreml

In our environment we could load the coreml model without an error. Could you give us a hint to reproduce the problem in our environment?

I do have the same problem but with a custom trained model based on yolov8 I've trained on Google Colab and export it. First I also tried to convert the ".pt" into the ".mlmodel" with no custom training that loads without any problem.

When I load the custom trained one the program directly crashes when I clicked on "auto labeling" after loading the custom trained model "best.mlmodel".

Do you have any clue what I could try and what information you need to help me?

ryouchinsa commented 1 year ago

Thanks for writing the issue. Could you share the detailed situation to reproduce the problem?

In our environment, the ultralytics version is 8.0.176. pip install -U ultralytics

Using our fish-dataset, we trained the YOLOv8 segmentation model.

yolo segment train data=fish.yaml model=yolov8n-seg.pt epochs=100 imgsz=640

And, export the best.pt to the best.mlpackage file.

yolo export model=best.pt format=coreml

スクリーンショット 2023-09-13 16 35 51

Using the latest RectLabel version 2023.09.12, we can load the best.mlpackage file and process the image to obtain the detected polygons.

スクリーンショット 2023-09-13 16 32 55

Optics commented 1 year ago

Ah okay. I trained the model on detection instead of segmentation. Could that be a problem?

I will try it later this week with training it on segmentation.

CodeCutterUK commented 1 year ago

Interesting, yes I am using detection and classification.


From: Optics @.> Sent: 13 September 2023 09:00 To: ryouchinsa/Rectlabel-support @.> Cc: Mark Ison @.>; Author @.> Subject: Re: [ryouchinsa/Rectlabel-support] CoreML failing to load (Issue #234)

Ah okay. I trained the model on detection instead of segmentation. Could that be a problem?

I will try it later this week with training it on segmentation.

— Reply to this email directly, view it on GitHubhttps://github.com/ryouchinsa/Rectlabel-support/issues/234#issuecomment-1717136772, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB4HRDZZOY73TDVZXAPG5A3X2FR25ANCNFSM6AAAAAA32ENEXM. You are receiving this because you authored the thread.Message ID: @.***>

Optics commented 1 year ago

I am using an M1 MacBook Air. Is Apple Silicon a problem?

ryouchinsa commented 1 year ago

We checked on the Apple M1 MacBook Pro device.

Using our fish-dataset-detection, we trained the YOLOv8 detection model.

yolo detect train data=fish-detection.yaml model=yolov8n.pt epochs=100 imgsz=640

And, export the best.pt to the best.mlpackage file.

yolo export model=best.pt format=coreml

スクリーンショット 2023-09-13 19 11 56

Using the latest RectLabel version 2023.09.12, we can load the best.mlpackage file and process the image to obtain the detected bounding boxes.

スクリーンショット 2023-09-13 19 08 49

ryouchinsa commented 1 year ago

For the permission issue, could you try deleting cache files? https://rectlabel.com/help#troubleshooting

For the crash issue, could you copy and paste the crash message to this page or send an email to support@rectlabel.com?

ryouchinsa commented 1 year ago

The new version 2023.09.27 was released. Fixed the crash when you run YOLOv8 models trained using except imgsz=640.

Please let us know your opinion.

ryouchinsa commented 1 year ago

Currently If you need our support to fix this problem, please let us know.