numpy錯誤解決方案


VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify ‘dtype=object’ when creating the ndarray
bboxes = np.array(bboxes)

在調用opencv一句簡單代碼時

while cv.waitKey(1) < 0:

出現以下錯誤

E:\Anaconda3\envs\labelimg\lib\site-packages\numpy\lib\function_base.py:793: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  return array(a, order=order, subok=subok, copy=True)

其實這不是錯誤,只是新版numpy的一個警告,可以忽略。當然總是顯示影響美觀,可以直接關閉該警告

np.warnings.filterwarnings('ignore', category=np.VisibleDeprecationWarning)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM