用戶上傳圖片時(shí)需要判斷這張圖是否屬于某類圖片,比如飛機(jī)。我找到的示例是一個(gè)圖片分類器,比如訓(xùn)練三個(gè)分類飛機(jī)、汽車、摩托,然后上傳一張圖片判斷這張圖片最接近哪一類。但是我并不確定用戶會(huì)上傳什么上來,比如我自己測(cè)試上傳了一張貓,而回顯的答案是飛機(jī)。顯然我不可能訓(xùn)練所有圖片分類,這也不符合我們的需求。希望能只訓(xùn)練飛機(jī)一個(gè)分類,然后上傳圖片時(shí)判斷是或否。示例中的代碼是用了sckikit-learn的極限森林算法聚類,但我查了這個(gè)api,沒有找到合用的方法.MethodsMethods
fit(X[, y]) Compute k-means clustering.
fit_predict(X[, y]) Compute cluster centers and predict cluster index for each sample.
fit_transform(X[, y]) Compute clustering and transform X to cluster-distance space.
get_params([deep]) Get parameters for this estimator.
predict(X) Predict the closest cluster each sample in X belongs to.
score(X[, y]) Opposite of the value of X on the K-means objective.
set_params(**params) Set the parameters of this estimator.
transform(X) Transform X to a cluster-distance space.請(qǐng)問應(yīng)該怎么解決呢?
如何判斷一張圖片是否是飛機(jī)或是否是鉛筆?
Helenr
2018-08-10 18:29:40