Technical Articles and Newsletters

野生动物径相机数据深入学习的实验

Mathworks的Cleve Moler


小径摄像机由动物运动自动触发。它们被世界各地的生态学家和野生动物经理用于研究野生动物行为,并帮助保护濒危物种。我想看看matlab®image processing and deep learning can be used to identify individual animal species that visit trail cameras. We are going to start with off-the-shelf functionality—nothing specialized for this particular task.

My partners on this project are Heather Gorr and Jim Sanderson. Heather is a machine learning expert at MathWorks. Jim was one of my Ph.D. students at the University of New Mexico. He spent several years at Los Alamos National Laboratory writing Fortran programs for supercomputers. But an interest in nature photography evolved into a desire to switch to a career in ecology. He is now the world’s leading authority on small wild cats. He is also the proprietor of CameraSweet, a software package used by investigators around the world to classify and analyze their trail camera data.

我们的数据

我们的研究在过去10年中,在过去的10年里,在过去的10年里,使用了美国鱼类和野生动物服务(FWS)办公室的数据从四个国家野生动物难民(NWRS)和一个私人牧场。通过映射工具箱™生产的图1中的地图显示了站点的位置。

Figure 1. The five data site locations.

Figure 1. The five data site locations.

大多数数据来自塞维利亚NWR,在新墨西哥州奇瓦华沙漠中的23万英亩的保护区。另一个网站,也是在新墨西哥州,是Armendaris牧场,泰德特纳拥有35万英亩的私人土地,亿万富翁的CNN成立者和女演员Jane Fonda的丈夫。

这re is a lot of data—almost 5 million images in total. Sevilleta and three other NWRs contributed almost 4 million images that have already been classified by human experts, while the Armendaris ranch and the Laguna Atascosa NWR in Texas contributed an additional million images that have not yet been classified.

Camerasweet有研究人员在文件夹集合中保存图像,每个摄像机的一个文件夹,每个物种的子文件夹,以及在单个图像中看到的动物数量。每个图像文件都标有记录时的日期和时间。

要阅读鱼类和野生动物服务数据,我们的MATLAB程序会创建一个字符串数组FWS., of length 3,979,549, containing the path names of all the images in the data set. For example:

k = 2680816;示例= FWS(k)示例=“D:SNWR \ Pino South(28)\ Bear \ 02 \ 2012 06 10 14 06 20.jpg”

FWS.entry for this example tells us that the data lives on a hard drive attached to my driveD:它来自地点Snwr,或塞维利亚NWR。相机是28号,位于Pino South。人类专家已将此数据保存到两只熊的摄像头文件夹中。

I searched through many two-bear images, looking for a cute one, and found the one shown in Figure 2. The name of the JPG image is a time stamp for June 10, 2012, 14:06:20 hours. The command

imshow(示例)

访问数据并生成图2。

图2.由相机28捕获的母亲熊和她的幼崽。

图2.由相机28捕获的母亲熊和她的幼崽。

命名和标签物种

Researchers using CameraSweet have some flexibility in the way they name species. “Mountain Lion” and “Puma” are the same animal. There are several different spellings of “Raccoon.” We have unified the names into 40 that we call standard. The names are shown in the column headed “species” below.

我们的matlab程序创建了第二个字符串数组,Labels,它具有图像的标准名称FWS.。UsingLabels,很容易计算每个标准物种的图像数量。

images percent species 1282762 32.23 Mule Deer 690131 17.34 Pronghorn 407240 10.23 Elk 264375 6.64 Bird 191954 4.82 Dove 184218 4.63 Ghost 173476 4.36 Oryx 120377 3.02 Raven 105931 2.66 Coyote 105718 2.66 Vulture 67643 1.70 Cow 45308 1.14 Human 40060 1.01 Fox 32849 0.83 Horse 31579 0.79 Cottontail 314390.79大角羊23818 0.60千斤顶0.51鹿18160 0.46哈格纳16286 0.41熊熊14898 0.37熊熊队14191 0.36熊熊队12617 0.32鹰头9882 0.32鹰头9882 0.21鹰头8342 0.21鹰7405 0.19几个6864 0.17 PUMA 6023 0.15未知4516 0.11车辆3863 0.10浣熊3427 0.09Roadrunner 2656 0.07猫头鹰2608 0.07蛇2164 0.05犰狳2029 0.05国内1985 0.05啮齿动物1909 0.05臭鼬1659 0.04獾1402 0.04巴氏羊

两个物种,“骡鹿”和“Pronghorn,”占据了近200万图像,这是我们数据的一半。物种“Ghost”描述了某些东西触发相机的情况,但图像中没有任何东西。幽灵在塞维利亚数据中被丢弃,但其他网站提供了充足的。名称“少数”是10种的捕获量,包括少于1000张图像的“ocelot”和“驴子”。

总体而言,在数据中有不同物种的程度,存在巨大的差异。一句话云提供了物种分布的良好可视化(图3)。

Figure 3. Word cloud showing relative distribution of species.

Figure 3. Word cloud showing relative distribution of species.

小径相机图像

一些图像提供了动物的优异肖像。图4显示了四个例子。

图4.示例跟踪相机图像。顺时针左下方:Coyote,Javelina,Pronghorn和Nilgai。

图4.示例跟踪相机图像。顺时针左下方:Coyote,Javelina,Pronghorn和Nilgai。

Javelina在中美洲和南美洲和北美的西南部。它们类似于野猪,但是一种独特的物种。Pronghorn和Coyotes在大多数地点都很常见。尼尔加在印度普遍存在,印度教徒将它们视为神圣。他们被引入20世纪20年代的德克萨斯州。他们在我们的网站中发现的唯一地方是Laguna Atascosa NWR。

大约三分之一的图像是在夜间用红外线进行的,并且出现在灰度中,如图5所示的前两个示例。

图5. TOP:两个灰度红外图像。底部:oryx的两个全彩图像。

Figure 5. Top: two grayscale infrared images. Bottom: two full-color images of an oryx.

即使图像显示出截然不同的观点,也是人类专家容易归类的两个oryx图像。传统的图像处理技术,它将寻找像腿部数量,鹿角的存在和风格等特征,以及尾部的类型,将被右下方的右下方的特写令人困惑。

有数以千计的图像由非浪费活动引发,包括人,奶牛,马,车辆和家畜。在图6中,右上方的图像已被归类为幽灵。

图6.非浪费活动活动触发的图像。顶部:人(左)和“幽灵”(右)。底部:“未识别”的图像。

图6.非浪费活动活动触发的图像。Top: A human (left) and a “ghost” (right). Bottom: “unidentified” images.

左下方的主题显然太近相机。右下图像中有微弱的黄色斑点,可能是一群小飞虫。这两个图像都被归类为“未识别”。

培训我们的深度学习网络

Inception-V3是广泛用于图像处理的卷积神经网络(CNN)。我们将使用从ImageNet数据库中使用超过一百万个图像的网络版本。Inception-V3是现成的图像CNN。它专门用于跟踪摄像机。我们选择从我们的40种中的每一个中的每一种随机样本为1400,并指定70%(980)作为训练图像和30%(420)作为验证图像。我们让训练在Linux上过夜®机器用GPU(Xeon®E5-1650v4处理器,3.5 GHz,6个HT核,64 GB RAM和12 GB NVIDIA®泰坦XP GPU)。

所结果的混乱图表(图7)是一个40×40的矩阵A,其中a(k,j)是预测在第j级中的k-th真实类中观察的次数。如果分类完美地工作,则矩阵将是对角线。在该实验中,对角线上的值全部为420.近距离对角线是一种准确性的度量:

accuracy = sum(diag(A))/sum(A,'all') = 0.8686
Figure 7. Confusion matrix, used to check the accuracy of the classifier.

Figure 7. Confusion matrix, used to check the accuracy of the classifier.

许多大型偏差元素并不令人惊讶。最小的对角线值216是鸟类。标记为鸟的行表明预测的类别通常是其他一些物种。下一个最小的对角线元素270,用于未知。在未知和其他物种之间存在混乱。Coyotes,对角线值为297,不要速度良好,也许是因为它们经常出现在模糊的图像中。鹿和尼尔加,对角线值358和352,具有良好的整体准确性,但彼此混淆。

另一方面,最常用的动物最常用的是兔羊,其对角线值为405.老鹰,马和叉角正确分类390或更多次。大角羊有一个386。

在未分类的图像上测试CNN

我们现在有一个CNN训练对轨迹进行分类camera images. How does it perform at a new location with images that have never been classified? We sample every tenth image from the Armendaris ranch, a total of 18,242. The CNN classification found 39 different species.

几乎一半的分类-8708-为大角羊。只有454岁是骡鹿。这意味着这意味着网络预测,Armendaris近20倍的骡子鹿近20倍,而塞维尔省距离北部少于100英里,达到了40倍的骡子鹿大角羊。

But this result doesn’t surprise Jim Sanderson. The mountains on Armendaris are the natural habitat for the sheep. The ranch manages the bighorn sheep in the same way that it manages its buffalo herds. Hunting bighorn rams is an important source of income for the ranch.

CNN分类标记为PUMA的93个图像。这似乎是高估的。检查93图像仅显示难以捉摸的动物的10或11个。

图8中的所有四个图像都来自armendaris。上两个分别由CNN正确分类为大角羊和彪马。但是较低的两个接收了相同的分类;这显然不正确。

Figure 8. Classification of previously unclassified images from the Armendaris ranch. The upper images are classified by the CNN as bighorn sheep and puma, evidently correctly.  The lower images are also classified as bighorn sheep and puma, apparently incorrectly.

Figure 8. Classification of previously unclassified images from the Armendaris ranch. The upper images are classified by the CNN as bighorn sheep and puma, evidently correctly. The lower images are also classified as bighorn sheep and puma, apparently incorrectly.

结论

Overall, this deep learning classifier is more successful than I would have predicted. Even in its current state, it may be useful to investigators. Any further development of our CNN should focus on designing features specific to trail camera image identification.

One thing is clear—the more data the better. The 5 million images collected by the Fish and Wildlife Service were essential for training a network to this level of accuracy.

致谢

感谢Jim Sanderson,在阿尔伯克基FWS赠送哈里斯,以及希瑟Gorr,Johanna Pingel,以及MathWorks新闻和票据editorial team.

Published 2020

View Articles for Related Industries