index 2 is out of bounds for axis 1 with size 2
在使用類似 keras.np_utils.to_categorical 的函式,對標籤轉換成one-hot編碼的時候,要使標籤從0開始。即如果是兩類,設標籤裡面的內容為0和1,不能設定為1和2或其他數字。
比如:
from keras.utils import np_utils x=[] x.append(2) x.append(1) print(x) x = np_utils.to_categorical(x, 2) print(x)
這就是錯誤的
from keras.utils import np_utils x=[] x.append(0) x.append(1) print(x) x = np_utils.to_categorical(x, 2) print(x)
這樣才正確
相關推薦
index 2 is out of bounds for axis 1 with size 2
在使用類似 keras.np_utils.to_categorical 的函式,對標籤轉換成one-hot編碼的時候,要使標籤從0開始。即如果是兩類,設標籤裡面的內容為0和1,不能設定為1和2或其他數字。 比如: from keras.utils import np_util
[Bug集合]InvalidArgumentError (see above for traceback): targets[0] is out of range
常見入門問題,在拷貝修改別人程式時一定概率出現。 原因:你一定是改了 神經網路輸出層神經元個數 或 給予神經網路的訓練集的標籤數目 其中的一種,使得兩者不匹配。 比如我拷貝了一個貓狗大戰的程式改,結果資料集分了10類,但神經網路層輸出神經元還是兩個(原貓和狗),結果不匹配了。 如: de
InvalidArgumentError: slice index xxx of dimension xxx out of bounds
InvalidArgumentError: slice index xxx of dimension xxx out of bounds 發生原因 解決辦法 完整Traceback 參考連結 發生原因 這是在呼叫Mask_RCNN
解決Eclipse中 An internal error has occurred. Index out of bounds reveal end of document 報錯
最近在做專案除錯的時候控制檯報錯資訊過多,導致Eclipse報出An internal error has occurred. Index out of bounds reveal end o
InvalidArgumentError (see above for traceback): targets[0] is out of range
說解決方法之前,先介紹tf.in_top_k(predictions, targets, k, name=None):predictions:shape=[batch_size,num_classes],type.flot32targets (the correct labe
Zend Studio 開發Resource is out of sync with the file system的解決辦法
SVN上down下來的專案,本地執行卻無法顯示頁面,經過嘗試給模板檔案改名就能迴避這個問題。 定位到是模板快取的問題,於是清模板快取。 但是發現ThinkPHP專案Runtime目錄下的快取檔案在刪除時候會提示: Resource is out of sync with the file
Mysql Update BIGINT UNSIGNED value is out of range
Mysql : update oneTab set num = num - #{count,jdbcType=INTEGER} where id = 1 num是int型別,但如果num=0時,則會報出相應 BIGINT UNSIGNED value is out o
JAVA型別直接輸入超過10位報The literal XXX of type int is out of range 解決辦法
Long.parseLong("XXX")或long number=xxxL java long與int取值範圍的問題 1:long l = 1024*1024*1024*4; //02:int i1 = 1024*1024*1024*4; //03:int i2 = 22000000000
Eclipse中修改包名,提交SVN時報 is out of date,怎麼辦?
問題:Eclipse中修改包名,提交SVN時報 is out of date,怎麼辦?描述: Hi,大家好! 我的問題如題,在不考慮用TortoiseSVN客戶端直接刪除目錄這個方法的情況下,有什麼方法能夠解決ECLIPSE下修改程式碼包名,提交SVN導致is out of d
解決“Default Boot2Docker ISO is out-of-date, downloading the latest release...”
load tor doc crt iss info The efault ref 看GitHub大概是作者忘記給ISO加上頭了,根據裏面一個解決方案,做成博客,首先下載HexEditor,然後打開ISO,crtl+g去到offset為8032行的位置,,粘貼-v18.09.
adb devices提示“adb server is out of data”解決方法
adb devices提示“adb server is out of data”解決方法 1、檢視5037埠被誰佔用了,輸入 netstat -aon|findstr “5037”,如下 C:\Users\ceshi>netstat -ano | findstr “5037” TC
打包時Resource is out of sync with the file system 報錯問題
這是檔案系統不同步的問題,是因為在eclipse之外對工程中的resource進行修改引起的;但是,有時沒有在eclipse之外進行修改,也會報類似的錯誤。 解決辦法:需要手動重新整理一下資源管理器。 (1)在eclipse中,工程目錄右鍵,選擇F5(refresh)&n
Chrome瀏覽器提示Adobe Flash Player is out of date的問題之解決
在使用Chrome瀏覽器一段時間後,會出現如下的提示: 如果你點選Update plug-in的話,瀏覽器會調轉到google.com/..的類似的網站上面,而google.com當前在大陸地區是
Mysql ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in..的解決方法
問題描述: 在寫mysql語句時會經常用到兩個時間戳相減來做查詢條件, SELECT abs(answer_time-question_time) FROM ... 因為欄位型別為unsign
BIGINT UNSIGNED value is out of range in..的解決方法
今天在做一個功能的時候,用到兩個時間戳相減來做查詢條件,由於其兩個欄位都是unsigned的,並兩個的大小是不一樣。所以直接相減查詢的時候, 就出現ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in.
CWE -- Out-of-bounds Write 例子
原文地址: https://cwe.mitre.org/data/definitions/787.html 1. 什麼是 out-of-bound write Description Summary The software writes data past t
IOException: Packet len5601403 is out of range!
客戶端連線ZK伺服器,然後即行ls /curator_sample,報錯如下: 從網上搜索到一篇文章:http://stackoverflow.com/questions/10249579/zookeeper-cli-failing-ioexception-packet-
EOS Node Remote Code Execution Vulnerability — EOS WASM Contract Function Table Array Out of Bounds
Vulnerability CreditYuki Chen of Qihoo 360 Vulcan TeamZhiniang Peng of Qihoo 360 Core SecurityVulnerability DescriptionWe found and successfully exploit a
Docker報錯: Default Boot2Docker ISO is out-of-date
安裝完docker-machine後,新建docker-machine命令: docker-machine create -d virtualbox pydm, 手工下載了Boot2Docker.iso, 錯誤資訊為"Default Boot2Docker ISO is o
STM8+STVD+COSMIC 學習筆記 address is out of range and is ignored
在連續整了一個下午,一個晚上,又一個上午之後終於可以用STVD除錯了!以此來紀念一下。 微控制器時STM8AF5189,工程是人家編譯好的,結果拿到手裡編譯後發現s19檔案變大了不少,而且裡面的地址出