基於python的簡易動物識別演算法(知識工程)

2021-09-30 01:21:24 字數 2619 閱讀 1618

#十個特徵,4類動物

animal =

['雞'

,'鴨'

,'魚'

,'狗'

]dict_feature =

dog_fea =

['吃肉'

,'有犬齒'

,'跑得快'

]fish_fea =

['有魚鱗'

,'會游泳'

,'有鰓'

]yazi_fea =

['有羽毛'

,'有爪'

,'會游泳'

]chick_fea =

['有羽毛'

,'有爪'

,'會下蛋'

]fea =

now_feature =

print

('**********************************'

)print

('*********all feature here*********'

)print

('**********************************'

)print

(dict_feature)

print

('**********************************'

)print

('*********all classial here********'

)print

('**********************************'

)print

('狗:{},魚:{},鴨:{},雞:{}'

.format

(dog_fea,fish_fea,yazi_fea,chick_fea)

)print

('**********************************'

)print

('*********請輸入3個特徵:***********'

)print

('**********************************'

)curr =

1while curr:

now_feature =

fea =

for i in

range(0

,3):

feature =

input

('請依次輸入3個特徵的數字序號:(輸入"exit()"可以退出)'

)if feature ==

'exit()'

: curr =

0break])

print

(now_feature[i]

)if curr ==0:

break

print

('您輸入的特徵是:{}'

.format

(now_feature)

) a =

0 b =

0 c =

0 d =

0 flag =

0for i in

range(0

,3):

if now_feature[i]

in dog_fea:

#print(now_feature[i]

a = a+

1if a >2:

print

('是狗'

) a =

0 flag =

1if now_feature[i]

in fish_fea:

#print(now_feature[i])

b = b+

1if b >2:

print

('是魚'

) b =

0 flag =

1if now_feature[i]

in yazi_fea:

#print(now_feature[i])

c = c+

1if c >2:

print

('是鴨'

) c =

0 flag =

1if now_feature[i]

in chick_fea:

#print(now_feature[i])

d = d+

1if d >2:

print

('是雞'

) d =

0 flag =

1if flag==0:

print

('無法準確判斷'

)if a >1:

print

('狗的概率為66%'

)if b >1:

print

('魚的概率為66%'

)if c >1:

print

('鴨的概率為66%'

)if d >1:

print

('雞的概率為66%'

)

python呼叫百度api動物識別

免費的,但識別幾百張後容易掉線 import requests url 字典form的image鍵對應的值為 data image jpeg base64,的64位編碼 form r requests.post url,data form 每天500次免費呼叫機會,之後0.8元 千次。但是也會出現掉...

基於GMM的語音識別python實現

用錄音寶錄下3到5個人的譜音每乙個,每個人10s到20s,建立gmm聲紋識別模板,設定場景 聲紋模板內的所有人交替討論乙個話題,大約2分鐘,用gmm模型分割識別講話人的身份。並統計時間。思路 通過提取音訊原本的語音特徵形成乙個集 聚類 以後,對後來的資料進行概率判斷,類似於之前的大作業使用的anno...

基於python的OCR中文字元識別

將翻譯成文字一般被稱為光學文字識別 optical character recognition,ocr 可以實現ocr 的底層庫並不多,目前很多庫都是使用共同的幾個底層ocr 庫,或者是在上面進行定製。tesseract 是乙個ocr 庫,目前由google 贊助 google 也是一家以ocr 和...