SimCenter Forum

Artificial Intelligence in Natural Hazards Engineering => AI use in Regional Simulation (BRAILS) => Topic started by: Niko Grisel Todorov on February 24, 2023, 12:49:05 AM

Title: ValueError: attempt to get argmin of an empty sequence
Post by: Niko Grisel Todorov 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
Title: Re: ValueError: attempt to get argmin of an empty sequence
Post by: bacetiner 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
Title: Re: ValueError: attempt to get argmin of an empty sequence
Post by: mikasa23 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 (https://fnf2.io/)
Title: Re: ValueError: attempt to get argmin of an empty sequence
Post by: larryellison on October 04, 2023, 02:54:30 AM
geometry dash bloodbath  (https://geometrydashbloodbath.com)
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
Title: Re: ValueError: attempt to get argmin of an empty sequence
Post by: williamliz on October 04, 2023, 09:11:04 AM
five nights at freddy's 4  (https://fivenightsatfreddys4.com)
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
Title: Re: ValueError: attempt to get argmin of an empty sequence
Post by: bacetiner 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.