Forum

Author Topic: Duplicate element keys not allowed  (Read 10642 times)

hluong

  • Newbie
  • *
  • Posts: 4
    • View Profile
Duplicate element keys not allowed
« on: June 17, 2019, 12:18:43 PM »
When I run a metashape python script I receive this warning message "Duplicate element keys not allowed", the third time I receive a runtime error with the same message (this happen when the masks are imported). About 50% of the time the script is running without problems, in other cases it stopped running because of this error. Any ideas?

An extract of the script I am running:

doc = Metashape.app.document
doc.save(os.path.join(pathtmp, docname))
doc.read_only = False

# create chunk and load images
chunk = doc.addChunk()
image_list1 = sorted(glob.glob(os.path.join(pathinput1, '*.png')))
chunk.addPhotos(image_list1)
image_list2 = sorted(glob.glob(os.path.join(pathinput2, '*.png')))
chunk.addPhotos(image_list2)
chunk.importMasks(source=Metashape.MaskSourceAlpha,operation=Metashape.MaskOperationReplacement)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15177
    • View Profile
Re: Duplicate element keys not allowed
« Reply #1 on: June 17, 2019, 12:33:41 PM »
Hello hluong,

Can you please specify, if this problem can be reproduced with minimal number of input images, for example, only one element in each list?

Can you also provide the log from the console pane related to the script run? (if there are any sensible data like filenames or paths, remove them prior to posting).
Best regards,
Alexey Pasumansky,
Agisoft LLC

hluong

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Duplicate element keys not allowed
« Reply #2 on: June 26, 2019, 01:30:26 PM »
I've started the script at 12h19, where the warnings and error occur. Immediately after this, I just run the same script again (12h21) and it then runs without problems... (it seems like a cold start problem?)

The log file:

2019-06-26 12:19:18 Agisoft Metashape Professional Version: 1.5.3 build 8407 (64 bit)
2019-06-26 12:19:18 Platform: Windows
2019-06-26 12:19:18 CPU: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz (desktop)
2019-06-26 12:19:18 CPU family: 6 model: 158 signature: 906E9h
2019-06-26 12:19:18 RAM: 64.0 GB
2019-06-26 12:19:18 OpenGL Vendor: NVIDIA Corporation
2019-06-26 12:19:18 OpenGL Renderer: GeForce GTX 1080 Ti/PCIe/SSE2
2019-06-26 12:19:18 OpenGL Version: 4.6.0 NVIDIA 398.75
2019-06-26 12:19:18 Maximum Texture Size: 32768
2019-06-26 12:19:18 Quad Buffered Stereo: not enabled
2019-06-26 12:19:18 ARB_vertex_buffer_object: supported
2019-06-26 12:19:18 ARB_texture_non_power_of_two: supported
2019-06-26 12:19:31 SaveProject: path = .../master.psx
2019-06-26 12:19:31 Saving project...
2019-06-26 12:19:31 saved project in 0.043 sec
2019-06-26 12:19:31 Finished processing in 0.043 sec (exit code 1)
2019-06-26 12:19:31 LoadProject: path = .../master.psx
2019-06-26 12:19:31 loaded project in 0.002 sec
2019-06-26 12:19:31 Finished processing in 0.002 sec (exit code 1)
2019-06-26 12:19:31 AddPhotos
2019-06-26 12:19:31 Loading photos...
2019-06-26 12:19:31 Finished processing in 0.055 sec (exit code 1)
2019-06-26 12:19:31 AddPhotos
2019-06-26 12:19:31 Loading photos...
2019-06-26 12:19:31 Finished processing in 0.057 sec (exit code 1)
2019-06-26 12:19:31 ImportMasks
2019-06-26 12:19:31 Warning! Duplicate element keys not allowedWarning!
2019-06-26 12:19:31 Duplicate element keys not allowed
2019-06-26 12:19:31 Generating masks...
2019-06-26 12:19:32 Finished processing in 1.301 sec (exit code 0)
2019-06-26 12:19:32 Traceback (most recent call last):
2019-06-26 12:19:32   File ".../tmp_metashape_stitching.py", line 48, in <module>
2019-06-26 12:19:32     chunk.importMasks(source=Metashape.MaskSourceAlpha,operation=Metashape.MaskOperationReplacement)
2019-06-26 12:19:32 RuntimeError: Duplicate element keys not allowed
2019-06-26 12:19:32 Error: Duplicate element keys not allowed
2019-06-26 12:21:08 SaveProject: path = .../master.psx
2019-06-26 12:21:08 Saving project...
2019-06-26 12:21:08 saved project in 0.076 sec
2019-06-26 12:21:08 Finished processing in 0.076 sec (exit code 1)
2019-06-26 12:21:08 AddPhotos
2019-06-26 12:21:08 Loading photos...
2019-06-26 12:21:08 Finished processing in 0.054 sec (exit code 1)
2019-06-26 12:21:08 AddPhotos
2019-06-26 12:21:08 Loading photos...
2019-06-26 12:21:08 Finished processing in 0.056 sec (exit code 1)
2019-06-26 12:21:08 ImportMasks
2019-06-26 12:21:08 Generating masks...
2019-06-26 12:21:09 Finished processing in 1.275 sec (exit code 1)
2019-06-26 12:21:09 ImportReference: columns = nxyz, delimiter = ;, path = ...\gps.txt
2019-06-26 12:21:09 Finished processing in 0.013 sec (exit code 1)
2019-06-26 12:21:09 MatchPhotos: accuracy = Highest, preselection = generic, keypoint limit = 0, tiepoint limit = 0, apply masks = 0, filter tie points = 0
2019-06-26 12:21:09 Matching photos...
2019-06-26 12:21:09 Detecting points...
2019-06-26 12:21:10 Using device: GeForce GTX 1080 Ti, 28 compute units, free memory: 9254/11264 MB, compute capability 6.1
2019-06-26 12:21:10   driver/runtime CUDA: 9020/5050
2019-06-26 12:21:10   max work group size 1024
2019-06-26 12:21:10   max work item sizes [1024, 1024, 64]
2019-06-26 12:21:10 [CPU] photo 0: 1644 points
2019-06-26 12:21:10 [CPU] photo 2: 1759 points
2019-06-26 12:21:10 [CPU] photo 3: 2011 points
2019-06-26 12:21:10 [CPU] photo 4: 1761 points
2019-06-26 12:21:10 [CPU] photo 5: 1824 points
2019-06-26 12:21:10 [GPU] photo 1: 1602 points
2019-06-26 12:21:10 [GPU] photo 7: 1801 points
2019-06-26 12:21:10 [GPU] photo 8: 1908 points
2019-06-26 12:21:10 [CPU] photo 6: 1703 points
2019-06-26 12:21:10 [GPU] photo 9: 1916 points

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15177
    • View Profile
Re: Duplicate element keys not allowed
« Reply #3 on: June 26, 2019, 07:33:30 PM »

Hello hluong,

after a brief investigation we assume that the problem could be related to the multithreading (may appear due to big number of CPU cores). We will try to add more checks for the mask import operation to avoid this problem in future.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Yoann Courtois

  • Sr. Member
  • ****
  • Posts: 316
  • Engineer in Geodesy, Cartography and Surveying
    • View Profile
Re: Duplicate element keys not allowed
« Reply #4 on: April 28, 2020, 04:56:18 PM »
Hey Alexey,

Has something been done regarding this issue ?

Regards
--
Yoann COURTOIS
R&D Engineer in photogrammetric process and mobile application
Lyon, FRANCE
--

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15177
    • View Profile
Re: Duplicate element keys not allowed
« Reply #5 on: April 28, 2020, 06:37:33 PM »
Hello Yoann,

I think it has been fixed already. Are you observing any similar problems in 1.6 version?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Yoann Courtois

  • Sr. Member
  • ****
  • Posts: 316
  • Engineer in Geodesy, Cartography and Surveying
    • View Profile
Re: Duplicate element keys not allowed
« Reply #6 on: April 28, 2020, 06:44:59 PM »
No, we still are on 1.5 version.

Wa are planning to switch to 1.6 but there have been lots of API change so. I was wondering if it can fix this problem, but it occure maybe twice a year so ...

We will soon make the most to go on 1.6.

Regards
--
Yoann COURTOIS
R&D Engineer in photogrammetric process and mobile application
Lyon, FRANCE
--

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15177
    • View Profile
Re: Duplicate element keys not allowed
« Reply #7 on: April 28, 2020, 07:25:33 PM »
Hello Yoann,

Which 1.5 version you are using? Does it happen in 1.5.4 or 1.5.5?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Yoann Courtois

  • Sr. Member
  • ****
  • Posts: 316
  • Engineer in Geodesy, Cartography and Surveying
    • View Profile
Re: Duplicate element keys not allowed
« Reply #8 on: April 28, 2020, 07:58:04 PM »
Please don't blame me but the error happened with 1.5.0 :S !
--
Yoann COURTOIS
R&D Engineer in photogrammetric process and mobile application
Lyon, FRANCE
--

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15177
    • View Profile
Re: Duplicate element keys not allowed
« Reply #9 on: April 28, 2020, 08:12:59 PM »
Then I doubt that there's any certain solution to avoid it, as the issue has been reported in 1.5.3.
Best regards,
Alexey Pasumansky,
Agisoft LLC

jkova96

  • Full Member
  • ***
  • Posts: 168
    • View Profile
Re: Duplicate element keys not allowed
« Reply #10 on: September 15, 2023, 10:11:12 PM »
Hi same problem with my Agisoft Metashape too,
I used version 1.5.1. and with that version I saved project to psz file...
Now...when I download this file from one of cloud storage service I get, same error...
 I, mean it's not comfortable when I faced with this...cause what to do now? It's not accessible.
Here's the file btw, but I can't guarantee that it will open...especially if someone opens this after "100 years"
https://mega.nz/file/NlxhnAwT#V5aMuUnUYsQZlKHUBGEguOEK1TbYDX65Q3fqgrw-bJk
or this
https://mega.nz/file/wlYEkD5a#sWh05KM6qMQt2ysEYueSFcJoACmQX7nbAGVAvRWg__I

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15177
    • View Profile
Re: Duplicate element keys not allowed
« Reply #11 on: September 19, 2023, 01:27:15 PM »
Hello jkova96,

Seems that the problem is related to the animation camera track created in versions 1.4.x. It should be fixed in the next update, but I could try to re-save them using the intermediate version and send back to you, if you cannot wait for the update.
Best regards,
Alexey Pasumansky,
Agisoft LLC