python各種問題:'NoneType' object has no attribute 'shape';Expected 2D array, got 1D array instead:
if __name__ =="__main__":
img_path=r"./smoke/allsmoke/image_3.jpg"
#img_path='./data/imagePart_train/smoke/allsmoke/image_3.jpg'
img = cv2.imread(img_path)
print(img.shape)
f=getFeature(img, 5)
print(f)
問題1: print(img.shape)
AttributeError: 'NoneType' object has no attribute 'shape'
解決方案:把img_path的路徑寫全,或者好好檢查該路徑下是否有影象
問題2:ValueError: Expected 2D array, got 1D array instead:
解決方案:在下圖所示的地方加上[ ]即可!
相關推薦
[python錯誤]builtins.AttributeError: 'module' object has no attribute 'request'
在python3.4.3版本下,使用wingIDE寫爬蟲的時候, 發生了builtins.AttributeError: 'module' object has no attribute 'request'的錯誤。 錯誤來源是程式碼中的 <span style="fo
Python AttributeError: 'Module' object has no attribute 'STARTF_USESHOWINDOW'
夫學須志也,才須學也,非學無以廣才,非志無以成學。——諸葛亮 生活有度,自得慈銘 ——杜錦陽 <hr/> 今天
python各種問題:39;NoneType39; object has no attribute 39;shape39;;Expected 2D array, got 1D array instead:
if __name__ =="__main__": img_path=r"./smoke/allsmoke/image_3.jpg" #img_path='./data/imagePart_train/smoke/allsmoke/image_3.jpg' img = cv2
python AttributeError: 39;NoneType39; object has no attribute 39;group39;
發現 png 完美解決 mage 過程 大寫 tee 使用 bsp 在使用正則表達式的過程中,經常報 AttributeError: ‘NoneType‘ object has no attribute ‘group‘ 的錯。 經一步步檢查,發現是【1】處寫成小寫
Python-AttributeError: 39;NoneType39; object has no attribute 39;groups39;
原始碼 原始碼如下,報錯: >>>import re >>>re_telephone = re.compile(r'^(\d{3})-(\d{3,8})$') >>>re_telephone.match('010-12345').
python-pip升級報錯- AttributeError: 39;NoneType39; object has no attribute 39;bytes39;
pop error pytho ear python環境 -- ati bytes hide 正常的pip升級命令: python -m pip install --upgrade pip 在pytharm裏面創建了一個Python項目,pytharm會自
python : 39;NoneType39; object has no attribute 39;string39;
there 一點 tor 裏的 names col python attribute 就是 html=""" #註意,第一次寫,縮進了一點點,python對格式十分註重。。<html><head><title>the dormouse
39;NoneType39; object has no attribute 39;__getitem__39;
getitem nonetype spa res color col result type ttr 報錯 ‘NoneType‘ object has no attribute ‘__getitem__‘ 你 result 返回的是 None ,所以 resul
解決 pip attributeerror 39;nonetype39; object has no attribute 39;bytes39;
pip nonetype bytes inux net error err tee pre for Windows : python -m pip install -U pip for Linux : pip install -U pip解決 pip attributeer
Python報錯:AttributeError: 39;RACNN39; object has no attribute 39;module39;
原始碼寫作方式是: import RACNN net = RACNN(num_classes = 2) 報錯展示: 報錯分析是:RACNN這個模組不能被呼叫。 解決思路:回到“RACNN”模組檢視: 分析報錯原因可知,我們是師徒將RACNN這個模組作為一個函式來呼叫
Python指令碼報錯:AttributeError:39;model39; object has no attribute 39;XXX39;解決方法
錯誤舉例: 錯位原因定位: 檢視import庫的原始檔,發現原始檔存在且沒有錯誤,同時存在原始檔的.pyc檔案 解決方法: 1、命名py指令碼時,不要與python預留字,模組名等相同 例如:模組是ssl,請不要命名ssl.py檔案,因為程式碼執行時會對應生成.pyc檔案。
TensorBoard tf.summary.merge_all() AttributeError: 39;NoneType39; object has no attribute 39;bucket 錯誤
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'inputs/x_input' with dtype float [[Node: inpu
AttributeError: 39;module39; object has no attribute 39;Process39;(關鍵詞:Python/bug/debug/模組/模組)
multiprocessing.py: import multiprocessing def work(): print 'Worker' return if __name__ == '__main__': jobs = []
AttributeError: 39;NoneType39; object has no attribute 39;lower39;資料庫遷移中做回退操作時報錯誤
1、以下為部分錯誤資訊: File “/home/python/.virtualenvs/flask_py3/lib/python3.5/sitepackages/sqlalchemy/sql/compiler.py”, line 3049, in _requires_quoteslc_
Python問題 : AttributeError: 39;module39; object has no attribute 39;SSL_ST_INIT39; 解決辦法
pip安裝paramiko包的時候未報錯,但執行pip list | grep paramiko時候報錯如下: $ pip list | grep paramiko Traceback (most recent call last): File "/usr/local/bin/pip
Traceback (most recent call last): File "AttributeError: 39;NoneType39; object has no attribute 39;group39;
Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'NoneType' object has no attribute 'group'
TypeError: 39;NoneType39; object has no attribute 39;__getitem__39;
記一次錯誤 我搜過這個錯誤,發現貌似很多問題都會引發這個錯誤 而我是在用OpenCV 的時候出現這個錯誤的 原因是我在對視訊的每一幀處理的while 迴圈裡面沒有加上如下語句: c = cv.waitKey(40) if cv.waitKey(50)
Python錯誤:AttributeError: 39;Worksheet39; object has no attribute 39;get_highest_row39; 解決辦法
https://blog.csdn.net/gaifuxi9518/article/details/80570746 今天開始學習《python程式設計快速上手》中的第12章:處理Excel電子表格。但是遇到了點小問題。 當我按照書中的方法獲取最大行和最大
appium基礎:滑屏和畫九宮格踩坑39;NoneType39; object has no attribute 39;execute39;
最近接觸到app操作:滑動螢幕和設定九宮格手勢密碼,發現挺好玩的,寫篇部落格記錄一下遇到的問題,附程式碼 滑屏swip 通常開啟一個app有引導頁,一般是向左滑動幾次後才能到主頁,appium藉助swip方法實現 使用方法 driver.swipe(x1,y1,x
python問題:AttributeError: 39;module39; object has no attribute 39;SSL_ST_INIT39;(轉)
原文地址:http://www.cnblogs.com/zhaijiahui/p/7344778.html AttributeError: 'module' object has no attribute 'SSL_ST_INIT' 問題背景: 下載工具wydomai