Author Topic: ValueError: attempt to get argmin of an empty sequence  (Read 20766 times)

Niko Grisel Todorov

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • moi
ValueError: attempt to get argmin of an empty sequence
« on: February 24, 2023, 12:49:05 AM »
While running InventoryGenerator.generate(attributes='all')
with location='Gaziantep, TR'

I get a FacadeParser.py:145, at minLineIdx = int(np.argmin(xp)/2), where apparently xp is an empty sequence, with the following complete error trace:

Determining the heights and roof pitch for each building...
Default facade parser model at tmp/models/facadeParser.pth loaded
 24%|██▍       | 48/200 [57:51<3:03:13, 72.33s/it]
Traceback (most recent call last):
  File "C:\GitHub\NHERI-GSC-MC-team1\code\startup.py", line 12, in <module>
    invGenerator.generate(attributes='all')
  File "C:\Python310\lib\site-packages\brails\InventoryGenerator.py", line 334, in generate
    facadeParserModel.predict(image_handler,storyModel)
  File "C:\Python310\lib\site-packages\brails\modules\FacadeParser\FacadeParser.py", line 368, in predict
    roof_run = compute_roofrun(footprint)
  File "C:\Python310\lib\site-packages\brails\modules\FacadeParser\FacadeParser.py", line 145, in compute_roofrun
    minLineIdx = int(np.argmin(xp)/2)
  File "<__array_function__ internals>", line 180, in argmin
  File "C:\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 1312, in argmin
    return _wrapfunc(a, 'argmin', axis=axis, out=out, **kwds)
  File "C:\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 57, in _wrapfunc
    return bound(*args, **kwds)
ValueError: attempt to get argmin of an empty sequence

Process finished with exit code 1

Any chance you can test for xp prior to the argmin(); or at least catch the exception more gracefully? Thank you in advance for your prompt response!
NGT
« Last Edit: February 24, 2023, 02:52:29 AM by Niko Grisel Todorov »

bacetiner

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: ValueError: attempt to get argmin of an empty sequence
« Reply #1 on: March 27, 2023, 05:43:25 PM »
Hi Niko,

Thank you for using the SimCenter Forum, and apologies that this message escaped our attention until today.

Something about this image seems to trigger an error with the way FacadeParser computes the roof run. For easier troubleshooting, any chance you could share the latitude/longitude of the building location that results in this error?

Thank you

mikasa23

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: ValueError: attempt to get argmin of an empty sequence
« Reply #2 on: July 25, 2023, 02:55:54 AM »
You can add a check to ensure 'xp' is not empty before calling np.argmin(). Here's how you could do it in Python:
Code: [Select]
if len(xp) > 0:
    minLineIdx = int(np.argmin(xp)/2)
else:
    # Handle the case when 'xp' is empty
    # For example, set minLineIdx to a default value or raise a specific exception
fnf

larryellison

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: ValueError: attempt to get argmin of an empty sequence
« Reply #3 on: October 04, 2023, 02:54:30 AM »
geometry dash bloodbath
You can add a check to ensure 'xp' is not empty before calling np.argmin(). Here's how you could do it in Python:
Code: [Select]
if len(xp) > 0:
    minLineIdx = int(np.argmin(xp)/2)
else:
    # Handle the case when 'xp' is empty
    # For example, set minLineIdx to a default value or raise a specific exception

Still failing to follow instructions. It seems like some step is not correct
« Last Edit: October 04, 2023, 02:57:48 AM by larryellison »

williamliz

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: ValueError: attempt to get argmin of an empty sequence
« Reply #4 on: October 04, 2023, 09:11:04 AM »
five nights at freddy's 4
Hi Niko,
Thank you for using the SimCenter Forum, and apologies that this message escaped our attention until today.

Something about this image seems to trigger an error with the way FacadeParser computes the roof run. For easier troubleshooting, any chance you could share the latitude/longitude of the building location that results in this error?

Thank you
I'm also interested in this information but it still hasn't been answered

bacetiner

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: ValueError: attempt to get argmin of an empty sequence
« Reply #5 on: January 17, 2024, 09:50:26 PM »
Thank you all for your interest in BRAILS. The latest version of BRAILS fully addresses this issue.

If you have any further questions or comments, please let me know.