Forum

Author Topic: Error when downloading AI model for automatic mask generation  (Read 1337 times)

Camilo Rada

  • Newbie
  • *
  • Posts: 12
    • View Profile
Error when downloading AI model for automatic mask generation
« on: January 30, 2025, 04:49:35 AM »
With version 2.2.0 build 19890, when trying the automatic mask generation (AI), it requests to "download a model 'U2Net v1' of the size 167.84 MB". After accepting, it downloads the file, and when the downloading finishes, it generates the following error:

"Error during downloading of the model: Assertion "Invalid model json, can't create model info" failed at line 415"

After accepting, it is followed by a second error:

"Error in generate mask dialog: Assertion "No models available for background masking after downloading" failed at line 98"

Is there a way to manually download the model or any other way to solve this problem?

Thanks

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15282
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #1 on: January 30, 2025, 02:26:23 PM »
Hello Camilo,

What OS version you are using and whether it happens for Standard or Professional edition of Metashape?

If you are using Windows, please send the json file from C:/<user>/AppData/Local/Agisoft/Metashape <Pro>/ai/ folder to support@agisoft.com.
« Last Edit: January 30, 2025, 03:09:58 PM by Alexey Pasumansky »
Best regards,
Alexey Pasumansky,
Agisoft LLC

Camilo Rada

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #2 on: January 31, 2025, 06:47:41 AM »
The OS is Ubuntu 22.04 with Metashape Professional
In this case, where should I look for that JSON file?

Thanks

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15282
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #3 on: January 31, 2025, 01:49:52 PM »
Hello Camilo,

Check the following location:
Code: [Select]
/home/<username>/.local/share/Agisoft/Metashape Pro/ai/default/
Send any .json files to us that you can find in the directory.

Best regards,
Alexey Pasumansky,
Agisoft LLC

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15282
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #4 on: January 31, 2025, 04:51:06 PM »
Hello Camilo,

We have implemented some fix on the server side, so can you please check, if you are able to download the masking model properly now using the same Metashape version?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Camilo Rada

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #5 on: January 31, 2025, 10:29:12 PM »
Thanks Alexei!

Now the downloading works just fine, and the masks are generated.
Unfortunately, the resulting masks are entirely useless for me. I'm using drone imagery and wanted to mask water bodies and the results have no relation at all with the water bodies.
What is this AI model trained for?
Is there any way to improve its performance in my application?
Thanks

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15282
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #6 on: February 03, 2025, 02:37:18 PM »
Hello Camilo,

Currently AI masking approach can be applied for close range objects to isolate the actual object from the background. Like object on the turntable, statue, etc.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Costas

  • Jr. Member
  • **
  • Posts: 82
  • Aerial Mapping
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #7 on: February 03, 2025, 04:13:39 PM »
Hello Alexey.

I tried to download the AI model and i get the same errors as in the first message.

"Error during downloading of the model: Assertion "Invalid model json, can't create model info" failed at line 415"

After accepting, it is followed by a second error:

"Error in generate mask dialog: Assertion "No models available for background masking after downloading" failed at line 98"

I am on
Windows 10 Pro 22H2
Metashape Pro 2.2.0 build 19890

in C:/<user>/AppData/Local/Agisoft/Metashape <Pro>/ai/ folder there is no json file. There is only one folder named "default" with no files in it,

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15282
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #8 on: February 03, 2025, 05:13:21 PM »
Hello Costas,

Do you have this problem today?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Costas

  • Jr. Member
  • **
  • Posts: 82
  • Aerial Mapping
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #9 on: February 03, 2025, 05:18:09 PM »
Yes i tried for the 1st time just before i posted the problem. I tried more than 5~6 times in the last 3 hours

Costas

  • Jr. Member
  • **
  • Posts: 82
  • Aerial Mapping
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #10 on: February 04, 2025, 10:26:04 AM »
I tried again this morning and get the same errors.

Is there a way to manually download the files needed and manually place them in required location?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15282
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #11 on: February 04, 2025, 03:50:18 PM »
Hello Costas,

Can you please clear C:/<user>/AppData/Local/Agisoft/Metashape Pro/ai/ folder and, just for case C:/Program Files/Agisoft/Metashape Pro/ai/ directory contents, if it exists, then try to re-download the AI mask model?
If the issue persists, please share the console pane output corresponding to the error. And additionally confirm that you see  2.2.0 build 19890 version number in Console pane.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Costas

  • Jr. Member
  • **
  • Posts: 82
  • Aerial Mapping
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #12 on: February 04, 2025, 04:08:34 PM »
I cleared C:/<user>/AppData/Local/Agisoft/Metashape Pro/ai/ folder (i even tried a second time and deleted the ai folder altogether).
I checked C:/Program Files/Agisoft/Metashape Pro/ai/ but there is no such ai folder.

I tried to download the model but i get the same errors.

The ai folder created itself again in C:/<user>/AppData/Local/Agisoft/Metashape Pro/ and it only contains a folder named "default" with nothing at it.  During the download there are 2 files named "U2Net_v1.json" and "U2Net_v1.onnx" but as download finishes and i get the error the files disappear. (see print screen)


Bellow is the complete console from opening Metashape to error messages.

Quote
2025-02-04 14:55:58 Agisoft Metashape Professional Version: 2.2.0 build 19890 (64 bit)
2025-02-04 14:55:58 Platform: Windows
2025-02-04 14:55:58 CPU: AMD Ryzen 7 2700X Eight-Core Processor (desktop)
2025-02-04 14:55:58 CPU family: 23 model: 8 signature: 800F82h
2025-02-04 14:55:58 RAM: 63.9 GB
2025-02-04 14:55:58 OpenGL Vendor: NVIDIA Corporation
2025-02-04 14:55:58 OpenGL Renderer: NVIDIA GeForce GTX 1070 Ti/PCIe/SSE2
2025-02-04 14:55:58 OpenGL Version: 4.6.0 NVIDIA 566.36
2025-02-04 14:55:58 Maximum Texture Size: 32768
2025-02-04 14:55:58 Quad Buffered Stereo: not enabled
2025-02-04 14:55:58 ARB_vertex_buffer_object: supported
2025-02-04 14:55:58 ARB_texture_non_power_of_two: supported
2025-02-04 14:55:59 To execute this script press Scripts/Add reference altitude
2025-02-04 14:55:59 To execute this script press Scripts/Align model or dense point cloud
2025-02-04 14:55:59 Script started...
2025-02-04 14:55:59 To execute this script press Scripts/Add reference offset
2025-02-04 14:55:59 To execute this script press Scripts/Bounding box to coordinate system
2025-02-04 14:55:59 To execute this script press Scripts/Color Model with Altitude
2025-02-04 14:55:59 To execute this script press Scripts/Color Model with Overlap
2025-02-04 14:55:59 To execute this script press Scripts/Coordinate system to bounding box
2025-02-04 14:55:59 To execute this script press Scripts/Copy bounding box
2025-02-04 14:55:59 To execute this script press Scripts/Detect objects
2025-02-04 14:55:59 To execute this script press Scripts/Export Depth Maps
2025-02-04 14:55:59 To execute this script press Scripts/Create footprint shape layer
2025-02-04 14:55:59 To execute this script press Scripts/Detect Fiducials
2025-02-04 14:55:59 To execute this script press Scripts/Import external depth
2025-02-04 14:55:59 To execute this script press Scripts/Import DJI trajectory_sbet.txt
2025-02-04 14:55:59 To execute this script press Scripts/Masking by color
2025-02-04 14:55:59 To execute this script press Scripts/Read RelativeAltitude from DJI metadata
2025-02-04 14:55:59 To execute this script press Scripts/Region Control
2025-02-04 14:55:59 To execute this script press Scripts/Remove assets
2025-02-04 14:55:59 To execute this script press Scripts/Remove disabled photos
2025-02-04 14:55:59 To execute this script press Scripts/Remove duplicated photos
2025-02-04 14:55:59 To execute this script press Scripts/Remove low quality photos
2025-02-04 14:55:59 To execute this script press Scripts/Remove Unpinned Projections
2025-02-04 14:55:59 To execute this script press Scripts/Render image
2025-02-04 14:55:59 To execute this script press Scripts/Render photos for cameras
2025-02-04 14:55:59 To execute this script press Scripts/Save estimated reference
2025-02-04 14:55:59 To execute this script press Scripts/Split calibration groups by order
2025-02-04 14:55:59 To execute this script press Scripts/Split in chunks
2025-02-04 14:55:59 To execute this script press Scripts/Transfer orientations
2025-02-04 14:55:59 To execute this script press Scripts/Undistort Photos
2025-02-04 14:56:21 LoadProject: path = D:/PHOTO TEST/2/2.psx
2025-02-04 14:56:21 Loading project...
2025-02-04 14:56:21 loaded project in 0.136 sec
2025-02-04 14:56:21 Finished processing in 0.136 sec (exit code 1)
2025-02-04 14:56:42 loaded mesh in 1.532 sec
2025-02-04 14:56:52 Downloading AI model (167.84 MB)...
2025-02-04 14:58:11 Finished processing in 78.579 sec (exit code 0)
2025-02-04 14:58:11 Error: Error during downloading of the model: Assertion "Invalid model json, can't create model info" failed at line 415
2025-02-04 14:58:22 Error: Error in generate mask dialog: Assertion "No models available for background masking after downloading" failed at line 98

Camilo Rada

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #13 on: February 05, 2025, 05:56:12 AM »
Hello Camilo,

Currently AI masking approach can be applied for close range objects to isolate the actual object from the background. Like object on the turntable, statue, etc.

OK, I see. Thanks for the clarification.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15282
    • View Profile
Re: Error when downloading AI model for automatic mask generation
« Reply #14 on: February 05, 2025, 07:53:59 PM »
Hello Costas,

Can you please check once again now, we have updated the part on the server side.
Best regards,
Alexey Pasumansky,
Agisoft LLC