Artificial Intelligence in Natural Hazards Engineering > AI use in Regional Simulation (BRAILS)

ValueError: attempt to get argmin of an empty sequence

(1/2) > >>

Niko Grisel Todorov:
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

bacetiner:
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:
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: ---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

--- End code ---
fnf

larryellison:
geometry dash bloodbath

--- Quote from: 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: ---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

--- End code ---


--- End quote ---
Still failing to follow instructions. It seems like some step is not correct

williamliz:
five nights at freddy's 4

--- Quote from: 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

--- End quote ---
I'm also interested in this information but it still hasn't been answered

Navigation

[0] Message Index

[#] Next page

Go to full version