Forum

Author Topic: Solving an Error with detection object script in agisoft  (Read 9689 times)

ro-teodoro

  • Newbie
  • *
  • Posts: 4
    • View Profile
Solving an Error with detection object script in agisoft
« on: February 13, 2023, 09:54:49 PM »

I am trying to follow this tutorial for detecting objects: https://agisoft.freshdesk.com/support/solutions/articles/31000162552-automatic-detection-of-objects-on-orthomosaic  , the training and detection are going very well but when I try to make a detection with the created model it gives me the following error in the console:

2023-02-13 09:17:09 Traceback (most recent call last):
2023-02-13 09:17:09   File "C:/Users/INFOGEOG02/Downloads/agi/metashape-scripts-master/src/detect_objects.py", line 1168, in <lambda>
2023-02-13 09:17:09     QtCore.QObject.connect(self.btnRun, QtCore.SIGNAL("clicked()"), lambda: self.process())
2023-02-13 09:17:09   File "C:/Users/INFOGEOG02/Downloads/agi/metashape-scripts-master/src/detect_objects.py", line 188, in process
2023-02-13 09:17:09     self.detect()
2023-02-13 09:17:09   File "C:/Users/INFOGEOG02/Downloads/agi/metashape-scripts-master/src/detect_objects.py", line 963, in detect
2023-02-13 09:17:09     self.add_trees(big_tile_to_world, big_tile_trees, detected_shapes_layer)
2023-02-13 09:17:09   File "C:/Users/INFOGEOG02/Downloads/agi/metashape-scripts-master/src/detect_objects.py", line 979, in add_trees
2023-02-13 09:17:09     p = Metashape.CoordinateSystem.transform(p, self.chunk.orthomosaic.crs, self.chunk.shapes.crs)
2023-02-13 09:17:09 TypeError: transform() argument 3 must be Metashape.CoordinateSystem, not None

Anyone know how to solve this error?

ro-teodoro

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Solving an Error with detection object script in agisoft
« Reply #1 on: February 13, 2023, 10:31:03 PM »
forget it, everything is cancelled. It takes the crs of the shapes in the project as a reference, it was only necessary to add the training shapes to use them in the detection. thanks all the same.

arpit.p

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Solving an Error with detection object script in agisoft
« Reply #2 on: August 01, 2024, 12:20:49 PM »
What did you to do resolve this?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15609
    • View Profile
Re: Solving an Error with detection object script in agisoft
« Reply #3 on: August 01, 2024, 12:24:08 PM »
Hello arpit.p,

Can you share the output from the Console pane related to the script run? (you can remove sensible folder paths, if necessary, before posting).
Best regards,
Alexey Pasumansky,
Agisoft LLC

arpit.p

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Solving an Error with detection object script in agisoft
« Reply #4 on: August 01, 2024, 12:35:25 PM »
Thanks for the reply!
The following error I am getting while running detections from a saved model. Although detections run on some other projects without any issues.
I am using 1.7 version of detect_objects.py

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15609
    • View Profile
Re: Solving an Error with detection object script in agisoft
« Reply #5 on: August 01, 2024, 01:42:54 PM »
Hello arpit.p,

Please check, that coordinate system for shapes is defined, providing that shapes are present in the project.

If it should be the same as for the chunk or orthomosaic, try to define it manually before running the script:
Code: [Select]
Metashape.app.document.chunk.shapes.crs = Metashape.app.document.chunk.crs
Best regards,
Alexey Pasumansky,
Agisoft LLC

arpit.p

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Solving an Error with detection object script in agisoft
« Reply #6 on: August 01, 2024, 01:49:16 PM »
2024-08-01 16:17:36 File "I:/SOLAR/Solar-2023/Module Detection/detect_objects_1.7.py", line 87, in <module>
2024-08-01 16:17:36 Metashape.app.document.chunk.shapes.crs = Metashape.app.document.chunk.crs
2024-08-01 16:17:36 AttributeError: 'NoneType' object has no attribute 'crs'
2024-08-01 16:17:36 Error: 'NoneType' object has no attribute 'crs'

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15609
    • View Profile
Re: Solving an Error with detection object script in agisoft
« Reply #7 on: August 01, 2024, 02:37:48 PM »
Are there any shapes in the project?
Best regards,
Alexey Pasumansky,
Agisoft LLC

arpit.p

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Solving an Error with detection object script in agisoft
« Reply #8 on: August 03, 2024, 07:32:12 AM »
Actually no. I think that was the issue.
Thanks for the reply.
I made a shape manually and then it works fine.