How many of these animals do you know

Introduction: Yesterday, the students participating in the 17th smart car competition sent me a demonstration video of a wireless charging car model on station B: Open source, the 17th smart car competition, BOT electronic energy-saving car, just play. I can't beat you in the game.

Key words: smart car competition, animal recognition, PaddleHub

 

§ 01 animal identification

1, Animal recognition in smart car competition

  in The 16th National College Student smart car competition Medium Indoor Vision Group The car model is required to detect the noise near the track Target Complete the corresponding actions according to the contents of the target (animals, fruits).

▲ Figure 1.1 task of intelligent vehicle in image recognition

  in order to improve the accuracy requirements of visual recognition in vehicle model works The 17th smart car competition Medium Intelligent Vision Group It is required to identify the sub categories in the major categories, that is, the software in the single chip microcomputer needs to be able to identify the sub categories in animals, fruits and vehicles. Therefore, the accuracy of the visual model is greatly improved.

2, PaddleHub one click animal recognition

  I saw it in AI Studio artificial intelligence learning and Shixun community of Baidu the day before yesterday PaddleHub one click animal recognition The teaching case shows the open source animal recognition model customized in PaddleHub:

   it supports one click animal recognition. It is an application for taking photos and identifying pictures. Let's test this open source network to see how many different animal species there are in each animal collection of the Organizing Committee of last year's smart car competition.

1. Preliminary test

(1) Install PaddleHub

  install the paddlehub in the Notebook.

!pip install paddlehub==1.6.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

(2) Test sample picture

test_img_path = ["./1.JPG", "./2.JPG", "./3.JPG"]

import matplotlib.pyplot as plt
import matplotlib.image as mpimg

for imgname in test_img_path:
    img1 = mpimg.imread(imgname)

    plt.figure(figsize=(10,10))
    plt.imshow(img1)

    plt.axis('off')
    plt.show()

▲ Figure 1.1 1 Giant Panda

▲ Figure 1.1 2 face pictures

▲ Figure 1.1 3 arctic fox

(3) Sample picture test results

 Ⅰ. Test code
#------------------------------------------------------------

import paddlehub as hub
module = hub.Module(name='resnet50_vd_animals')

#------------------------------------------------------------
import cv2

np_images = [cv2.imread(image_path) for image_path in test_img_path]
results = module.classification(images=np_images)

for r in results:
    printf(r)
 Ⅱ. Identification results
{'National treasure panda': 0.9751655459403992}
{'inanimate': 0.9993972778320312}
{'Arctic fox': 0.8418184518814087}

2. Smart car competition animal collection

  in the collection of animals in the intelligent vision group of the 16th intelligent car mirror competition, there are mainly five kinds of animals: dogs, cattle, cats, horses and pigs. These animals are often seen in human life. With the development of human society, many different varieties have been cultivated in the world. The following uses the animal recognition model in PaddleHub to tell us the species of these animals.

(1) Test code

from headm import *

import os

test_img_path = ["./1.JPG", "./2.JPG", "./3.JPG"]

cat_dir = '/home/aistudio/data/fruitanimal'
cat_num = 101

cat_img = [os.path.join(cat_dir, '%02d.jpg'%(i+1)) for i in range(cat_num)]

'''
import matplotlib.pyplot as plt
import matplotlib.image as mpimg

for imgname in cat_img:
    img1 = mpimg.imread(imgname)

    plt.figure(figsize=(10,10))
    plt.imshow(img1)

    plt.axis('off')
    plt.show()

    break
'''

import paddlehub as hub
module = hub.Module(name='resnet50_vd_animals')

import cv2
np_images = [cv2.imread(image_path) for image_path in cat_img]

results = module.classification(images=np_images)

for r in results:
    printf(r)

(2) Identification results

 Ⅰ. Dog recognition results

▲ Figure 1.2 1 picture of dog

  through identification, you can see a total of 101 pictures. There are 35 kinds of dogs identified, of which the two most breeds are golden retriever and Welsh corky.

Serial numbertypenumber
1Lhasa dog1
2Shiba Inu 8
3Eskimo Dog1
4jack russell terrier 2
5Japanese Akita 2
6Pug7
7West Highland White Terrier1
8Welsh Ke Ji14
9Labrador4
10American Akita 1
11German Shepherd3
12Tamaska dog1
13German Spitz 1
14China Tibetan Mastiff1
15Stafford Bullterrier1
16Rottweiler2
17Border Collie2
18Poodle lady dog3
19The Dachshund1
20Saint Bernard1
21inanimate1
22Chihuahua5
23boston terrier 2
24Alaskan sled dog2
25Dalmatian1
26Golden Retriever10
27Maltese Maltese1
28Chinese garden dog2
29Siberian Husky Dog7
30French Bulldog5
31Yorkshire Terrier 1
32Boxer 1
33Beagle3
34Lowchen 1
35Curly Bichon frise2
{'Japanese Akita ': 0.4390193223953247}
{'Poodle/Poodle': 0.7055565714836121}
{'Golden Retriever': 0.8339270949363708}
{'Beagle': 0.4970936179161072}
{'German Spitz ': 0.5624755620956421}
{'Golden Retriever': 0.6434336304664612}
......
{'Golden Retriever': 0.7351966500282288}
{'Labrador': 0.9914411306381226}
{'Siberian Husky Dog': 0.5635216236114502}
 Ⅱ. Identification results of cattle

▲ Figure 1.2 2 pictures of cattle

There are 93 pictures in the picture collection of   cattle, of which 22 are identified, and the most cattle is Xiangxi yellow cattle.

Serial numbertypenumber
1Indian bison5
2White Yak2
3Dairy cattle6
4And cattle4
5Wild goat1
6Southern cattle2
7African buffalo9
8Dexter cattle1
9Musk ox2
10Simmental1
11Qinchuan 2
12Highland cattle3
13Limousin cattle1
14calf 3
15China Holstein 9
16Swiss brown cattle3
17buffalo8
18Xiangxi Yellow Cattle15
19Jersey 1
20Java bison1
21Yak8
22American bison6
{'Indian bison': 0.7731859087944031}
{'And cattle': 0.34460482001304626}
{'China Holstein ': 0.4629508852958679}
{'China Holstein ': 0.4254103899002075}
{'China Holstein ': 0.395224004983902}
. . . . . . 
{'Limousin cattle': 0.2524842321872711}
{'African buffalo': 0.5881295204162598}
{'American bison': 0.6179811358451843}
{'calf ': 0.2019311934709549}
{'Simmental': 0.10599607974290848}
 Ⅲ. Cat recognition results

▲ Figure 1.2 3 pictures of cats

  there are 99 pictures of cats, and 37 species are identified. The two most species: domestic cat and tiger spotted cat.

Serial numbertypenumber
1Red cat2
2Manchekan cat1
3Norwegian Forest Cat3
4Japanese cat1
5Shorthair7
6American bristle cat3
7Domestic cat17
8Ocelot2
9Persian cat1
10Highland cat2
11Teacup cat1
12Streptopelia roseogrisea 1
13American silver short haired cat2
14Silk dog1
15Scotland fold2
16Chinese Li Hua 2
17Cow cat4
18USA Shorthair2
19Folding cat1
20Purebred cat1
21Maine cat1
22Cohen house cat1
23Devon rex 1
24european burmese 1
25Tiger spotted cat14
26Ragdor cat1
27british shorthair 9
28Bombay cat1
29Native cat2
30Cream cat2
31Siberian cat2
32Turkish Angora cat1
33snowshoe 1
34Chinese garden cat2
35Corat cat1
36Thailand Siam cat2
37Russian knapweed1
{'Domestic cat': 0.26924195885658264}
{'Scotland fold': 0.47249680757522583}
{'Cow cat': 0.48933151364326477}
{'Tiger spotted cat': 0.6846295595169067}
{'Turkish Angora cat': 0.16593654453754425}
{'Ocelot': 0.6253762245178223}
. . . . . . 
{'American silver short haired cat': 0.42112547159194946}
{'Shorthair': 0.35389307141304016}
{'American bristle cat': 0.43220415711402893}
{'American bristle cat': 0.4108104407787323}
{'Red cat': 0.2033773958683014}
 Ⅳ. Horse recognition results

▲ Figure 1.2 4 photos of horses

  there are 95 pictures of horses, and 10 kinds of horses are identified. Most of them are horses.

Serial numbertypenumber
1Ili horses1
2fine horse77
3Apalusama1
4Arabian horse2
5Mongolian horse1
6Wuzhumuqinma3
7Mini Horse2
8Pony1
9Don 4
10Ferghana horse3
{'fine horse': 0.6022858023643494}
{'fine horse': 0.950950562953949}
{'fine horse': 0.8656469583511353}
{'fine horse': 0.6158687472343445}
. . . . . . 
{'fine horse': 0.5660824179649353}
{'Mongolian horse': 0.3801785707473755}
{'fine horse': 0.5563110113143921}
{'fine horse': 0.4901660680770874}
{'fine horse': 0.9210300445556641}
 Ⅴ. Identification results of pigs

▲ Figure 1.2 5 photos of pigs

  there are 88 pictures of the second elder martial brother, and 14 types are identified. The most are domestic pigs and breeding pigs.

Serial numbertypenumber
1Domestic pig25
2Special wild boar2
3Landrace1
4Hampshire pig1
5Pet pig9
6Fragrant pig7
7Heishan pig4
8Congjiang Xiang pig4
9Xi Xi2
10Rongchang pig1
11Breeding pig16
12Binary sow5
13Beijing black pig7
14Small fragrant pig4
{'Domestic pig': 0.5635786056518555}
{'Fragrant pig': 0.5747232437133789}
{'Landrace': 0.34550777077674866}
{'Breeding pig': 0.32950359582901}
{'Small fragrant pig': 0.4352666139602661}
. . . . . . 
{'Domestic pig': 0.4807981252670288}
{'Domestic pig': 0.6012528538703918}
{'Domestic pig': 0.816167414188385}
{'Domestic pig': 0.6905205845832825}
{'Small fragrant pig': 0.4659614562988281}

 

 

§ 02 wireless charging

  yesterday, the students participating in the 17th smart car competition sent me a demonstration video of a wireless charging model on station B:

  Open source, the 17th smart car competition, BOT electronic energy-saving car, just play. I can't beat you in the game.

▲ Figure 1 blogger's electronic car
▲ Figure 2 the model runs after charging on the track

■ links to relevant literature:

● relevant chart links:

Added by VDarkAzN on Mon, 13 Dec 2021 05:33:45 +0200