Commit 67452edd authored by Noric Couderc's avatar Noric Couderc Committed by Alexandru Dura
Browse files

Implemented checking with the test set

parent 895f0d50
......@@ -1960,57 +1960,65 @@
},
{
"cell_type": "code",
"execution_count": 126,
"execution_count": 158,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"from torchvision import datasets\n",
"from torch.utils.data import DataLoader, SubsetRandomSampler\n",
"from torch.utils.data import DataLoader, Subset, SubsetRandomSampler\n",
"from torch.utils.data import random_split # For splitting into sets.\n",
"\n",
"# Loading the images into a dataset.\n",
"data_dir = \"images/\"\n",
"\n",
"# We only take the first 10000 pictures\n",
"indices = range(10000)\n",
"indices = range(3000)\n",
"\n",
"dataset = datasets.ImageFolder(os.path.realpath(data_dir),\n",
" transform=preprocessing)\n",
"\n",
"# We need to create a dataloader, which controls the batches we need.\n",
"# I try to only use a subset of the data but it isn't working...\n",
"dataloader = DataLoader(dataset, batch_size=4, num_workers=2,\n",
" sampler=SubsetRandomSampler(indices))\n",
"subset = Subset(dataset, indices)\n",
"\n",
"# train_data, val_data = random_split(dataset, (2000, 500))"
"size_train_data = int(0.8 * len(subset))\n",
"size_test_data = len(subset) - size_train_data\n",
"\n",
"train_data, val_data = random_split(subset, \n",
" (size_train_data, size_test_data))\n",
"\n",
"# We make to dataloaders which only load a subset of the data\n",
"train_dataloader = DataLoader(train_data, \n",
" batch_size=4,\n",
" num_workers=2,\n",
" shuffle=True)\n",
"val_dataloader = DataLoader(val_data, \n",
" batch_size=4, \n",
" num_workers=2,\n",
" shuffle=True)"
]
},
{
"cell_type": "code",
"execution_count": 123,
"execution_count": 153,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<torch.utils.data.dataloader.DataLoader at 0x7fa48b984550>"
]
},
"execution_count": 123,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"DataLoader(train_data)"
"classes_names = dataset.classes"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 159,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using cache found in /home/noric/.cache/torch/hub/pytorch_vision_v0.5.0\n"
]
}
],
"source": [
"# Setting up the alternative model\n",
"\n",
......@@ -2019,7 +2027,7 @@
},
{
"cell_type": "code",
"execution_count": 81,
"execution_count": 160,
"metadata": {},
"outputs": [
{
......@@ -2027,11 +2035,11 @@
"text/plain": [
"Sequential(\n",
" (0): Dropout(p=0.2, inplace=False)\n",
" (1): Linear(in_features=1280, out_features=1001, bias=True)\n",
" (1): Linear(in_features=1280, out_features=1000, bias=True)\n",
")"
]
},
"execution_count": 81,
"execution_count": 160,
"metadata": {},
"output_type": "execute_result"
}
......@@ -2043,7 +2051,7 @@
},
{
"cell_type": "code",
"execution_count": 82,
"execution_count": 161,
"metadata": {},
"outputs": [],
"source": [
......@@ -2075,7 +2083,7 @@
},
{
"cell_type": "code",
"execution_count": 102,
"execution_count": 140,
"metadata": {},
"outputs": [],
"source": [
......@@ -2088,24 +2096,24 @@
},
{
"cell_type": "code",
"execution_count": 120,
"execution_count": 162,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 2000] loss: 1.445\n",
"[2, 2000] loss: 1.217\n",
"Finished Training\n"
]
}
],
"source": [
"model.train() # Tchoo tchoo\n",
"\n",
"for epoch in range(2): # loop over the dataset multiple times\n",
"\n",
" running_loss = 0.0\n",
" for i, data in enumerate(dataloader, 0):\n",
" for i, data in enumerate(train_dataloader, 0):\n",
" # get the inputs; data is a list of [inputs, labels]\n",
" inputs, labels = data\n",
"\n",
......@@ -2127,6 +2135,123 @@
"\n",
"print('Finished Training')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Testing the network against test data\n",
"\n",
"To check if the network has learned anything, we need to test it on new data, see if it learned anything."
]
},
{
"cell_type": "code",
"execution_count": 163,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"tensor([[[ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, 0.2111, ..., 0.0398, 0.0000, 0.0000],\n",
" ...,\n",
" [ 0.0000, 0.0000, 0.1426, ..., -0.5082, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000]],\n",
"\n",
" [[ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, -0.2150, ..., -1.0028, 0.0000, 0.0000],\n",
" ...,\n",
" [ 0.0000, 0.0000, -0.3200, ..., 0.2052, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000]],\n",
"\n",
" [[ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, -0.4798, ..., -1.3687, 0.0000, 0.0000],\n",
" ...,\n",
" [ 0.0000, 0.0000, -0.7238, ..., 0.9145, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],\n",
" [ 0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000]]])"
]
},
"execution_count": 163,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Test the network against test data (for a few examples)\n",
"\n",
"# We load a batch of pictures\n",
"test_data_iter = iter(val_dataloader)\n",
"images, labels = test_data_iter.next()\n",
"\n",
"# Show the images\n",
"torchvision.utils.make_grid(images)"
]
},
{
"cell_type": "code",
"execution_count": 164,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ground truth: baby_back_ribs apple_pie baby_back_ribs apple_pie\n",
"Predicted: beet_salad chicken_wings pulled_pork_sandwich chicken_wings\n"
]
}
],
"source": [
"# Print the ground truth (the label we know of)\n",
"print(\"Ground truth: \",\n",
" \" \".join('%5s' % classes_names[labels[j]] for j in range(4)))\n",
"\n",
"model_food.eval()\n",
"\n",
"# Get predictions from the network\n",
"outputs = model_food(images)\n",
"\n",
"# Output the prediction of the network.\n",
"_, predicted = torch.max(outputs, 1)\n",
"print(\"Predicted: \", \" \".join('%5s' % classes_names[predicted[j]]\n",
" for j in range(4)))"
]
},
{
"cell_type": "code",
"execution_count": 165,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Accuracy of the network on the 10000 test images: 0 %\n"
]
}
],
"source": [
"correct = 0\n",
"total = 0\n",
"with torch.no_grad():\n",
" for data in val_dataloader:\n",
" images, labels = data\n",
" outputs = model_food(images)\n",
" _, predicted = torch.max(outputs.data, 1)\n",
" total += labels.size(0)\n",
" correct += (predicted == labels).sum().item()\n",
" prin\n",
"\n",
"print('Accuracy of the network on the 10000 test images: %d %%' % (\n",
" 100 * correct / total))"
]
}
],
"metadata": {
......
%% Cell type:markdown id: tags:
# Object detection for Autonomous Systems 1
This notebook is for experiments with PyTorch and MobileNet.
%% Cell type:markdown id: tags:
## Checking PyTorch works
The following commands are for checking that PyTorch works and if it has access to CUDA (it's okay if it doesn't, computations will just be slower).
%% Cell type:code id: tags:
``` python
from __future__ import print_function
import torch
x = torch.rand(5, 3)
print(x)
```
%%%% Output: stream
tensor([[0.4026, 0.2347, 0.7283],
[0.9675, 0.2745, 0.0301],
[0.7576, 0.9682, 0.1278],
[0.5820, 0.9611, 0.9176],
[0.0758, 0.9665, 0.9982]])
%% Cell type:code id: tags:
``` python
import torch
torch.cuda.is_available()
```
%%%% Output: execute_result
False
%% Cell type:markdown id: tags:
## Loading MobileNet v2
The commands in the following section are borrowed from [this page](https://pytorch.org/hub/pytorch_vision_mobilenet_v2/).
%% Cell type:code id: tags:
``` python
# Downloading the model from the internet and printing info about it.
model = torch.hub.load('pytorch/vision:v0.5.0', 'mobilenet_v2', pretrained=True)
model.eval() # Sets the module in EVALUATION MODE.
```
%%%% Output: stream
Using cache found in /home/noric/.cache/torch/hub/pytorch_vision_v0.5.0
%%%% Output: execute_result
MobileNetV2(
(features): Sequential(
(0): ConvBNReLU(
(0): Conv2d(3, 32, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=32, bias=False)
(1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): Conv2d(32, 16, kernel_size=(1, 1), stride=(1, 1), bias=False)
(2): BatchNorm2d(16, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(2): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(16, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(96, 96, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=96, bias=False)
(1): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(96, 24, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(24, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(3): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(24, 144, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(144, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(144, 144, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=144, bias=False)
(1): BatchNorm2d(144, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(144, 24, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(24, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(4): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(24, 144, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(144, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(144, 144, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=144, bias=False)
(1): BatchNorm2d(144, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(144, 32, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(5): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=192, bias=False)
(1): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(192, 32, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(6): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=192, bias=False)
(1): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(192, 32, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(7): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(192, 192, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=192, bias=False)
(1): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(192, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(8): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(384, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(9): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(384, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(10): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(384, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(11): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(384, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(12): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(576, 576, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=576, bias=False)
(1): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(576, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(13): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(576, 576, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=576, bias=False)
(1): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(576, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(14): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(576, 576, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=576, bias=False)
(1): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(576, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(160, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(15): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(160, 960, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(960, 960, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=960, bias=False)
(1): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(960, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(160, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(16): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(160, 960, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(960, 960, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=960, bias=False)
(1): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(960, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(160, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(17): InvertedResidual(
(conv): Sequential(
(0): ConvBNReLU(
(0): Conv2d(160, 960, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(1): ConvBNReLU(
(0): Conv2d(960, 960, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=960, bias=False)
(1): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
(2): Conv2d(960, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)
(3): BatchNorm2d(320, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(18): ConvBNReLU(
(0): Conv2d(320, 1280, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(1280, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU6(inplace=True)
)
)
(classifier): Sequential(
(0): Dropout(p=0.2, inplace=False)
(1): Linear(in_features=1280, out_features=1000, bias=True)
)
)
%% Cell type:markdown id: tags:
CNNs have two different types of layers:
1. Convolutional layers
2. Fully connected layer
If MobileNet is like that, we can know where to cut our network. Just re-use the convolutional layers.
%% Cell type:markdown id: tags:
This above printed (I think) the structure of the network.
What's particularly interesting is the last layer of the network, called classifier.
Sequential() seems to be just a way to "link" layers together (see [Sequential doc](https://pytorch.org/docs/stable/nn.html?highlight=sequential#torch.nn.Sequential)). The "classifier" is composed of two layers:
1. Dropout layer: which during training zeroes randomly some elements of the input tensor (This is good for the
2. Linear layer: Linear transformation of incoming data
This seems a bit stiff to use fo classifying our pictures (I was hoping for a fully connected layer) but ok.
%% Cell type:code id: tags:
``` python
# Download an example image from the pytorch website
import urllib
url, filename = ("https://github.com/pytorch/hub/raw/master/dog.jpg", "dog.jpg")
try: urllib.URLopener().retrieve(url, filename)
except: urllib.request.urlretrieve(url, filename)
```
%% Cell type:markdown id: tags:
The command above downloaded a file and put it in `dog.jpg` in the the notebook directory.
The dog is cute.
%% Cell type:code id: tags:
``` python
# sample execution (requires torchvision)
from PIL import Image
from torchvision import transforms
input_image = Image.open(filename)
# I think this resized the picture and does some processing on pixels.
preprocess = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])
input_tensor = preprocess(input_image)
input_batch = input_tensor.unsqueeze(0) # create a mini-batch as expected by the model
# move the input and model to GPU for speed if available
if torch.cuda.is_available():
input_batch = input_batch.to('cuda')
model.to('cuda')
with torch.no_grad():
output = model(input_batch)
# Tensor of shape 1000, with confidence scores over Imagenet's 1000 classes
print(output[0])
# The output has unnormalized scores. To get probabilities, you can run a softmax on it.
print(torch.nn.functional.softmax(output[0], dim=0))
```
%%%% Output: stream
tensor([ 2.0977e+00, -1.7348e+00, -2.2355e+00, -2.9669e+00, -2.3805e+00,
9.7397e-01, -1.6049e+00, 3.6914e+00, 6.3812e+00, -1.2929e+00,
-6.7555e+00, -3.3525e+00, -7.9619e+00, -4.4554e+00, -5.6423e+00,
-4.6624e+00, -1.9577e+00, -3.5811e-01, -1.2812e+00, -4.6707e+00,
-3.2935e+00, -2.5674e+00, -2.4351e+00, -1.3017e+00, -3.2453e+00,
-1.4237e+00, -1.2001e+00, 4.1274e-01, -1.6093e+00, 1.5871e+00,
2.7725e-01, -6.2652e-01, -2.9734e-01, -3.8219e+00, -1.5450e+00,
-2.8976e+00, -5.6528e-01, -2.3938e+00, -3.3704e-01, 1.2809e+00,
-1.2516e+00, -2.6469e+00, -3.1011e+00, -2.2447e+00, -4.4385e-01,
-1.2620e+00, 8.2895e-01, -2.0436e+00, -6.6037e-01, -8.6523e-02,
4.8967e-01, -1.7190e+00, -7.7943e-01, -1.1046e+00, -5.3857e-01,
-2.9254e+00, -1.9327e+00, -2.7273e+00, -6.0903e-01, -1.6802e+00,
1.3443e+00, -4.2062e+00, -1.4768e+00, -4.5581e+00, -3.2726e+00,
-4.0086e+00, 1.5702e-01, -1.9921e+00, -7.4553e-01, -4.2230e+00,
-3.8855e+00, -9.4837e-01, -2.1373e+00, -3.5562e+00, -2.4602e+00,
-3.2339e+00, -3.1414e+00, -2.6786e+00, -3.4321e-01, 1.3021e+00,
-1.8081e+00, -6.9590e-01, 6.0993e-01, 1.0629e+00, 7.0008e-01,
-2.1399e+00, -8.3321e-01, -1.2712e+00, -2.9445e+00, 2.6159e+00,
-3.0859e+00, -3.9236e+00, -5.0966e+00, -2.6899e+00, -4.2541e+00,
-5.7496e+00, -1.4612e+00, -3.3379e+00, -5.1146e+00, 1.3199e-01,
6.4283e-01, -3.8178e+00, -6.0668e-01, -3.8236e+00, 8.3375e+00,
-2.0877e-01, 1.5727e+00, -3.2569e+00, -1.3088e+00, -4.3541e+00,
-1.8997e+00, -4.4558e+00, -2.6055e+00, -4.8200e-01, 6.5847e-01,
-1.1139e+00, -1.9922e+00, -2.9861e+00, 6.3541e-02, -4.1181e-02,
-4.9799e+00, -3.5623e-01, 6.9234e-02, 2.6185e-02, 1.0603e+00,
-3.7500e+00, -2.2764e+00, -1.1260e+00, -3.6557e+00, -1.0141e+00,
-3.8173e+00, -2.6216e+00, 8.1060e-01, -4.8440e+00, -1.8047e-01,
-3.7860e+00, -2.7942e+00, -4.0452e+00, -2.7590e+00, -7.6154e+00,
-6.3294e+00, -3.7503e+00, -4.7911e+00, -2.9558e+00, -1.1693e+00,
-1.1443e+00, 4.1418e-01, -2.1690e+00, -2.2886e+00, -1.6754e+00,
-2.3970e+00, 6.1470e+00, 6.3288e+00, 4.1129e+00, 5.7730e+00,
1.3963e+00, 3.3142e-01, 8.0281e+00, 1.5755e+00, -1.1558e-02,
3.4568e-02, -7.4600e-01, 5.0004e-01, -1.5472e+00, -2.2847e+00,
-3.6398e+00, -6.4526e-01, -2.2491e+00, 1.6223e-01, 4.6008e+00,
3.4056e+00, 7.1302e-02, -1.5552e+00, 5.0138e+00, 5.8507e+00,
1.5491e+00, -2.0445e+00, 2.4170e+00, -2.4798e+00, 1.2948e+00,
1.9327e+00, -2.7864e+00, 1.2956e+00, 2.8686e-01, 2.5281e+00,
4.3597e+00, 5.6367e+00, -6.1374e-01, 3.3545e+00, -2.7333e-01,
2.3449e+00, -1.3377e+00, 5.4958e+00, 4.5115e+00, 2.6891e-01,
1.1485e+00, -1.2563e-01, 1.1168e+00, 6.3621e-02, 6.5230e+00,
2.4672e+00, 4.8819e-01, -3.3207e-01, 9.2125e+00, 1.6410e+00,
1.3188e+00, 1.9943e-01, 4.5677e+00, 2.1875e+00, 2.2087e-01,
-2.4104e+00, 6.0055e-01, 3.0084e+00, -5.4444e-01, -1.2983e+00,
2.8078e+00, 1.9668e+00, 2.0604e+00, 7.7009e-01, 1.6875e+00,
1.9477e+00, -7.9099e-01, 7.2126e+00, 9.0092e+00, 8.0076e+00,
2.3563e+00, 3.7544e+00, 5.7382e+00, 3.8081e+00, 6.5486e+00,
9.7228e+00, 1.0013e+01, 9.5305e+00, 2.3904e+00, -5.0377e-01,
5.1103e+00, 5.7608e-01, 1.5447e+00, 1.2857e+00, 3.5652e+00,
2.5450e+00, 1.4888e+00, -8.1306e-01, -2.7417e+00, 8.7089e-01,
-5.8501e-01, -4.0766e-01, 3.2671e+00, 9.6768e+00, 8.9972e+00,
9.2585e+00, 1.4055e+00, 1.1183e-01, 2.6599e+00, -1.4223e+00,
1.1165e+00, 5.2566e+00, 9.9246e+00, 1.4355e+01, 1.1880e+01,
5.9999e+00, 1.0196e+01, -3.5385e-01, 8.2910e+00, 6.0059e+00,
6.8347e-01, 4.1931e-01, 2.0777e+00, -5.5983e-01, 4.8030e+00,
9.0072e+00, 1.7113e+00, 2.3010e+00, 4.5991e+00, 3.6477e+00,
-9.0076e-01, 8.6038e-01, 4.4647e+00, 2.8593e+00, 9.2391e+00,
3.4026e+00, 3.9940e+00, 3.7692e+00, 7.0309e+00, 3.9052e+00,
4.3277e+00, -3.0220e-01, 3.9064e+00, 1.5825e-01, 1.4127e+00,
-2.0500e+00, -1.2154e+00, 1.4670e+00, -1.4580e+00, -1.5738e+00,
-1.3263e+00, 9.2756e-02, -2.6180e+00, -1.4926e-01, -7.5718e-01,
-5.3535e+00, -3.6209e+00, -2.3243e+00, -1.6823e+00, -3.7550e+00,
-3.8941e+00, -7.9255e-01, -1.5161e+00, -5.7227e+00, -2.8694e+00,
-7.2898e-01, -4.1100e-01, -7.2024e-01, 3.7914e-02, -1.0243e+00,
-3.3016e+00, -3.5730e+00, -1.9918e+00, -1.6733e+00, -5.8971e+00,
-5.3597e+00, -3.9750e+00, -3.6543e+00, -4.1491e+00, -2.9045e+00,
-1.0445e+00, -2.6859e+00, -1.9066e+00, -2.3439e+00, -6.2355e-01,
3.5224e+00, 6.2726e+00, 8.5430e+00, 5.0669e+00, 1.8273e+00,
4.6736e+00, 8.4476e-01, -1.9572e-02, 3.3690e+00, -1.0283e-01,
-2.4612e+00, 2.4195e+00, -5.1352e-01, -3.5476e+00, -3.5470e+00,
2.0303e-01, -1.3766e+00, -2.6088e+00, 2.4946e+00, -2.3945e+00,
-1.1865e+00, -4.9946e+00, -3.3072e+00, -4.2007e-01, -3.7238e+00,
5.3880e+00, 3.4567e+00, 1.0361e+00, 3.7673e+00, 4.1483e+00,
-6.8158e-01, 2.9724e+00, -2.6524e-01, 8.0892e-01, -1.7007e+00,
-2.0444e+00, -2.9546e+00, -3.2660e+00, -8.8699e-01, -3.3023e+00,
-3.3806e-01, 1.2563e+00, -8.9535e-01, 1.4541e+00, 9.4996e-01,
-2.0507e+00, -4.4067e+00, 2.2796e+00, -6.8594e-01, -8.8652e-01,
1.5170e+00, -3.8388e-01, -4.0742e-01, 9.6686e-01, 1.2590e+00,
-4.6555e+00, -6.3739e+00, 7.4363e-01, -1.3343e+00, -7.2346e-02,
-2.0423e+00, 3.7000e-01, -3.5627e+00, -1.9930e+00, -1.8647e+00,
1.3201e+00, -3.7614e+00, -2.9709e+00, -1.0222e+00, -1.9434e+00,
-2.9945e+00, 2.2073e-01, 1.7212e+00, -2.3659e+00, -1.2634e+00,
-1.0104e+00, -4.0589e+00, 2.7514e-02, 1.4427e+00, 7.0132e-02,
-3.4568e+00, 1.0521e+00, 3.5129e+00, 6.4661e-01, -1.4407e+00,
-2.4270e-01, -3.5198e+00, -9.4175e-01, -1.0295e+00, 3.3603e-01,
2.0016e-01, -8.9978e-02, 2.2656e-01, -9.6323e-01, -1.7674e+00,
6.4673e-01, -3.3782e-02, 4.2802e+00, 5.3263e+00, 2.2384e+00,
-3.5597e+00, 1.1807e+00, 4.5926e-02, -2.6271e+00, 1.0758e-01,
1.2795e+00, 1.5737e+00, 1.1931e+00, -2.4457e+00, -8.4555e-01,
2.8623e+00, 2.8806e-01, -5.9178e-01, -9.3240e-01, 1.4194e+00,
-1.0869e+00, 8.0468e-01, 2.6026e+00, -1.2723e+00, -7.7224e-01,
2.2809e+00, -1.4838e+00, 5.8849e-01, -9.0864e-01, -2.9350e+00,
-1.5003e+00, 2.7366e+00, 2.9118e+00, -2.5303e-01, -1.1096e+00,
2.3799e+00, 7.6073e-01, 5.4272e+00, 4.6897e+00, -1.3155e-01,
-8.0122e-01, -3.1159e+00, -4.0464e+00, 6.5657e-01, 2.0462e+00,
2.7152e+00, 2.0442e+00, 1.9868e+00, -1.4363e+00, -2.0505e+00,
-1.6228e+00, -7.0752e-01, 6.1674e-01, 2.5873e+00, 2.1843e+00,
-6.1809e-01, -1.9566e+00, -8.5768e-01, 7.1875e-01, 2.1852e+00,
2.9276e-01, -2.9160e+00, 4.7730e-01, 2.0784e+00, 4.0771e+00,
-2.4195e-01, 1.3048e+00, -5.0637e-01, -3.4089e-01, 6.6665e-01,
-1.1453e+00, 1.2197e+00, -1.6476e+00, 1.0244e+00, -1.2751e-02,
-3.8730e+00, 1.3927e+00, 3.1080e+00, 2.1766e+00, 1.2397e-02,
8.3346e-01, 6.3474e-01, 6.4802e-01, 1.8221e+00, -2.7608e+00,
-3.6870e+00, 1.3747e+00, 9.1805e-02, 8.2602e-01, -1.5124e+00,
2.2673e+00, 1.3143e-01, -2.9091e+00, -1.5961e-01, 2.5890e+00,
-1.2447e+00, -1.2865e+00, 5.8338e+00, 1.6895e+00, -2.0549e-01,
-1.0211e+00, -2.4552e+00, -5.0936e-01, -5.2974e-01, -4.5987e-01,
2.6499e-01, -2.9162e+00, -3.0222e+00, 2.2564e-01, 1.5582e+00,
-1.2585e-01, -1.8132e+00, 2.3501e+00, -3.3209e+00, 4.9566e+00,
-4.9510e+00, -7.4566e-01, 2.1571e+00, 7.6538e-01, 2.0662e+00,
1.6266e+00, -1.2199e-01, -4.3637e+00, -2.1941e+00, -3.0787e-01,
-3.8238e+00, -1.6580e+00, 4.3411e+00, 2.7014e-01, -3.5598e-01,
-2.5363e-01, -4.9809e-01, 2.2959e+00, 2.2455e+00, 8.4955e-01,
-9.5632e-01, -1.0922e-02, 2.0119e-01, 6.2614e-01, -2.0728e+00,
-2.8902e+00, 1.5548e+00, 7.2548e-01, -1.0286e+00, 4.4618e-02,
-1.0328e+00, -6.1001e-02, 8.5735e-02, 2.3276e+00, 2.5550e+00,
1.4773e+00, -2.1379e+00, 8.2632e-01, 9.0537e-01, 5.8717e-01,
1.4047e-01, 1.2880e+00, -1.2447e+00, -3.0260e+00, 1.3479e+00,
6.5378e-01, 1.0272e+00, 1.3767e+00, 1.0319e+00, 4.7779e-01,
5.2349e-01, -8.8269e-01, -1.4962e+00, -1.1824e+00, 1.1074e+00,
-2.2532e+00, 2.1382e+00, 9.7307e-01, -1.0083e+00, -1.6575e+00,
-9.5758e-04, 1.6627e+00, -2.1514e+00, -2.3709e+00, -3.4100e+00,
-5.2928e-01, 1.9259e-01, -8.0650e-01, 1.6568e+00, -5.1726e-01,
-1.5838e-01, -8.9716e-01, -4.5829e+00, 1.4675e+00, -4.5201e-01,
1.2436e+00, 6.0141e-01, -3.8649e-01, -1.7420e+00, -1.5792e+00,
9.3821e-01, 4.2496e+00, 1.1979e+00, -2.4132e-01, -3.2378e+00,
-1.0954e+00, -9.6521e-02, 1.8683e+00, 1.1284e+00, 2.0860e+00,
9.5167e-01, 1.8403e+00, 2.5347e-01, 1.8567e-01, -1.2812e+00,
-6.6936e-01, 2.0522e+00, 1.4342e+00, -2.2879e-01, -8.0857e-01,
1.9737e+00, 1.1951e+00, -8.6991e-01, -6.7026e-01, 5.4058e-01,
-4.6110e-01, 2.6557e+00, -1.3025e+00, -1.6542e+00, -1.3156e+00,
3.2369e-01, -5.4370e-01, 1.6666e+00, 4.5700e+00, -2.3573e+00,
1.2469e+00, 1.1997e+00, 4.0686e+00, -7.7598e-03, -1.1327e+00,
1.3139e+00, -3.5416e-01, -6.1601e-01, -3.9956e+00, 1.6335e+00,
-1.0202e+00, -4.5716e-01, 5.7760e-01, -3.4985e+00, -1.1559e-01,
-4.9487e-01, 6.6963e-01, -6.2700e-01, 1.0441e+00, 3.0509e+00,
-3.1207e-01, 2.7649e+00, 6.2701e-01, -1.7978e+00, -2.0636e+00,
6.7859e-01, 1.0197e-01, -1.0705e+00, 3.0527e-01, -1.7576e+00,
1.1912e+00, -2.5650e+00, -2.0395e+00, -2.3384e-02, -6.6742e-01,
-1.3196e+00, -1.5473e+00, 1.4445e+00, 4.8465e-01, -2.8597e-01,
2.0573e+00, 1.8837e+00, -4.4886e-01, -5.9843e-01, 1.4961e+00,
4.2709e+00, 4.7194e-02, -3.9729e+00, 1.6866e+00, 1.1838e-01,
-2.1901e+00, -1.4564e+00, 6.3495e-01, -6.9224e-02, -1.1540e-01,
-2.6747e+00, -1.8754e+00, -3.3249e-02, -1.3887e+00, -5.8239e-01,
-2.6332e+00, 2.9077e+00, 7.7976e-01, 1.2104e+00, 1.8161e+00,
-1.2151e+00, 1.0008e+00, 2.1955e+00, 3.8305e+00, -1.8397e+00,
5.7438e-01, -3.9989e+00, -2.8352e-01, 2.3984e+00, -1.1624e+00,
7.7795e-01, 4.9292e+00, -1.8727e+00, 4.6069e+00, -4.2315e+00,
2.9490e-01, -2.9247e+00, -4.1031e-01, -2.6956e-01, -3.2782e+00,
5.1224e-02, -1.1451e+00, 1.9002e+00, -3.3774e+00, 3.5610e+00,
-5.8406e-01, -2.5784e-01, 2.5958e+00, 4.8148e-01, 3.4009e+00,
1.9466e+00, 4.3969e+00, 3.1025e+00, 1.8707e+00, 2.3226e+00,
-1.7758e+00, 4.5991e+00, -3.1057e-01, 2.5523e+00, -4.3005e-01,
1.1663e+00, 3.7423e+00, -3.3202e+00, 2.9863e+00, 2.3991e+00,
1.8163e+00, 6.2833e-01, -3.0631e+00, 1.3832e+00, 2.3446e-01,
4.5703e-01, -5.2095e-01, -6.3540e-01, -2.3105e+00, -9.3954e-02,
4.7082e-01, -4.4529e-01, 3.7371e-01, -1.8174e+00, -1.6152e+00,
-3.7139e-01, -5.7884e-01, 1.7545e+00, 7.7587e-01, -7.8316e-02,
1.6373e-02, -2.9957e+00, 1.5097e+00, -1.9589e+00, -2.1457e+00,
8.6147e-01, 1.3731e+00, 4.8385e+00, 1.1895e+00, -5.1667e-02,
-6.9186e-01, -2.4000e+00, 2.2452e+00, -2.8816e+00, 2.9604e-01,
-2.4871e-02, -1.6365e+00, 5.4108e-01, 7.9194e-01, -4.7307e-01,
3.3787e+00, 3.1171e-01, -4.7706e-01, 4.7993e-01, -2.1351e+00,
-1.1842e+00, 2.8761e+00, -2.5128e+00, 6.7475e-01, 4.2304e-01,
-1.5113e-01, -2.4046e-01, 2.6086e+00, 2.2590e+00, -1.3191e+00,
-1.4585e+00, -1.7858e-01, 2.4934e-02, 3.6163e+00, 1.1935e+00,
1.5226e+00, 1.1416e+00, 1.3794e+00, 1.2284e+00, -3.1586e+00,
1.8730e+00, 5.6497e-01, 3.5441e-01, 3.7591e+00, -7.5653e-01,
1.4521e+00, 9.2728e-01, 1.7928e+00, 1.3086e+00, 3.3281e-01,
2.5021e+00, 1.2359e-01, -1.9837e+00, -1.9212e+00, 2.2389e+00,
1.7770e+00, -1.0251e+00, 1.1154e+00, -5.6650e-01, 8.5459e-01,
-9.2451e-01, 1.7175e+00, 5.5464e+00, -1.1396e+00, -1.0508e+00,
9.4548e-01, -1.1248e+00, -4.1178e+00, -1.5001e+00, -2.4440e+00,
-2.2460e+00, 2.9526e-01, 6.0924e-02, -6.5618e-02, -3.6811e-01,
-3.9457e+00, -2.5774e-01, 1.0757e+00, 2.7218e-01, 1.2959e-01,
2.9834e+00, 1.5601e+00, -1.3121e+00, -3.4189e+00, -4.8114e+00,
-7.6683e-02, 2.9641e+00, -1.4930e+00, -1.4022e+00, 3.6878e+00,
2.2555e+00, 2.3702e-01, 3.8400e+00, -5.7365e-01, -2.9713e+00,
-1.8238e+00, -2.4696e-01, -5.4835e+00, -1.7653e+00, -1.3388e-01,
-3.1702e+00, -1.5837e+00, -6.3625e-01, -4.9745e-01, -1.8403e+00,
1.0520e+00, 1.6680e+00, 1.8475e+00, 4.0332e+00, 1.3918e+00,
-3.2777e+00, -4.6016e-01, 1.0744e+00, -3.8841e-01, 2.3637e+00,
-5.5233e-02, -1.5773e-01, 1.7894e+00, 8.5378e-01, 6.7841e-01,
7.2238e-01, 7.0537e-01, 3.4570e+00, 3.3763e-01, -1.2732e+00,
-1.6014e+00, -1.1200e-01, -5.0247e+00, -9.6371e-01, -2.9871e-01,
-5.2167e-01, -2.2425e+00, -3.0319e+00, -1.8120e-01, -1.8274e+00,
-2.9185e+00, -5.3206e+00, -4.1687e-01, -1.1471e+00, 4.0239e+00,
1.6161e+00, -7.2602e-01, 2.2094e+00, -3.8634e+00, -2.6027e-01,
1.3907e+00, 2.0412e+00, 1.4310e+00, -5.5395e-01, 8.4763e-01,
1.2557e+00, -2.3636e+00, 5.4899e-01, 2.3557e-01, -2.1998e+00,
-3.3631e+00, -2.3922e+00, -1.7042e+00, 2.6087e+00, 1.6107e+00,
-3.4292e-01, -4.9724e-01, -3.1873e+00, -4.1049e-01, -1.3927e+00,
-3.3978e-01, -1.3094e+00, 3.4262e-01, 2.9870e+00, -1.0335e+00,
-5.0580e-01, 7.1299e-01, -1.3783e+00, -2.2482e+00, -3.8999e+00,
-2.0363e+00, 1.1213e+00, -4.8775e+00, 3.2949e-01, 1.5133e+00,
1.1563e+00, 2.0571e+00, 5.9265e-01, -3.9987e+00, -7.2273e-01,
2.9365e+00, -1.7806e+00, 1.8060e+00, -2.9915e-01, -1.3355e+00,
4.0328e-01, 1.8246e-02, -1.7064e-01, -2.5046e+00, -2.3489e-01,
-5.1013e-01, -7.8851e-01, 1.9875e+00, -2.5939e-01, -2.7370e+00,
6.9350e-01, -1.7628e+00, -5.1119e-01, -6.8332e+00, -4.1562e+00,
-2.5831e+00, -1.4274e+00, -3.0766e+00, 1.6652e+00, 3.3317e+00])
tensor([3.9432e-06, 8.5398e-08, 5.1760e-08, 2.4907e-08, 4.4774e-08, 1.2819e-06,
9.7241e-08, 1.9409e-05, 2.8588e-04, 1.3284e-07, 5.6362e-10, 1.6938e-08,
1.6868e-10, 5.6221e-09, 1.7157e-09, 4.5706e-09, 6.8331e-08, 3.3832e-07,
1.3440e-07, 4.5330e-09, 1.7967e-08, 3.7139e-08, 4.2395e-08, 1.3168e-07,
1.8854e-08, 1.1656e-07, 1.4577e-07, 7.3131e-07, 9.6812e-08, 2.3665e-06,
6.3864e-07, 2.5867e-07, 3.5951e-07, 1.0593e-08, 1.0324e-07, 2.6695e-08,
2.7501e-07, 4.4179e-08, 3.4552e-07, 1.7424e-06, 1.3845e-07, 3.4300e-08,
2.1779e-08, 5.1287e-08, 3.1052e-07, 1.3701e-07, 1.1088e-06, 6.2707e-08,
2.5006e-07, 4.4388e-07, 7.8978e-07, 8.6757e-08, 2.2200e-07, 1.6037e-07,
2.8245e-07, 2.5964e-08, 7.0061e-08, 3.1653e-08, 2.6324e-07, 9.0185e-08,
1.8563e-06, 7.2130e-09, 1.1053e-07, 5.0733e-09, 1.8347e-08, 8.7892e-09,
5.6629e-07, 6.6024e-08, 2.2965e-07, 7.0927e-09, 9.9400e-09, 1.8749e-07,
5.7098e-08, 1.3817e-08, 4.1344e-08, 1.9071e-08, 2.0919e-08, 3.3230e-08,
3.4340e-07, 1.7796e-06, 7.9357e-08, 2.4134e-07, 8.9071e-07, 1.4011e-06,
9.7474e-07, 5.6951e-08, 2.1037e-07, 1.3576e-07, 2.5472e-08, 6.6207e-06,
2.2114e-08, 9.5691e-09, 2.9609e-09, 3.2859e-08, 6.8756e-09, 1.5411e-09,
1.1226e-07, 1.7188e-08, 2.9081e-09, 5.5229e-07, 9.2050e-07, 1.0637e-08,
2.6386e-07, 1.0575e-08, 2.0220e-03, 3.9281e-07, 2.3327e-06, 1.8639e-08,
1.3075e-07, 6.2214e-09, 7.2417e-08, 5.6197e-09, 3.5750e-08, 2.9889e-07,
9.3501e-07, 1.5889e-07, 6.6013e-08, 2.4436e-08, 5.1575e-07, 4.6447e-07,
3.3275e-09, 3.3895e-07, 5.1870e-07, 4.9684e-07, 1.3974e-06, 1.1383e-08,
4.9683e-08, 1.5698e-07, 1.2508e-08, 1.7556e-07, 1.0642e-08, 3.5180e-08,
1.0886e-06, 3.8116e-09, 4.0408e-07, 1.0980e-08, 2.9603e-08, 8.4727e-09,
3.0664e-08, 2.3852e-10, 8.6299e-10, 1.1379e-08, 4.0188e-09, 2.5185e-08,
1.5032e-07, 1.5414e-07, 7.3236e-07, 5.5320e-08, 4.9083e-08, 9.0621e-08,
4.4040e-08, 2.2618e-04, 2.7128e-04, 2.9585e-05, 1.5561e-04, 1.9554e-06,
6.7419e-07, 1.4839e-03, 2.3392e-06, 4.7844e-07, 5.0103e-07, 2.2954e-07,
7.9802e-07, 1.0301e-07, 4.9273e-08, 1.2709e-08, 2.5387e-07, 5.1062e-08,
5.6925e-07, 4.8191e-05, 1.4584e-05, 5.1977e-07, 1.0219e-07, 7.2829e-05,
1.6818e-04, 2.2783e-06, 6.2654e-08, 5.4267e-06, 4.0539e-08, 1.7667e-06,
3.3434e-06, 2.9834e-08, 1.7682e-06, 6.4481e-07, 6.0647e-06, 3.7864e-05,
1.3578e-04, 2.6200e-07, 1.3857e-05, 3.6825e-07, 5.0495e-06, 1.2702e-07,
1.1793e-04, 4.4071e-05, 6.3334e-07, 1.5263e-06, 4.2686e-07, 1.4787e-06,
5.1580e-07, 3.2941e-04, 5.7060e-06, 7.8861e-07, 3.4724e-07, 4.8504e-03,
2.4977e-06, 1.8096e-06, 5.9082e-07, 4.6620e-05, 4.3138e-06, 6.0363e-07,
4.3455e-08, 8.8239e-07, 9.8035e-06, 2.8080e-07, 1.3212e-07, 8.0219e-06,
3.4596e-06, 3.7991e-06, 1.0454e-06, 2.6164e-06, 3.3942e-06, 2.1945e-07,
6.5653e-04, 3.9582e-03, 1.4537e-03, 5.1072e-06, 2.0670e-05, 1.5028e-04,
2.1811e-05, 3.3795e-04, 8.0800e-03, 1.0798e-02, 6.6663e-03, 5.2841e-06,
2.9246e-07, 8.0211e-05, 8.6107e-07, 2.2683e-06, 1.7507e-06, 1.7107e-05,
6.1678e-06, 2.1450e-06, 2.1465e-07, 3.1199e-08, 1.1563e-06, 2.6964e-07,
3.2196e-07, 1.2698e-05, 7.7165e-03, 3.9110e-03, 5.0790e-03, 1.9735e-06,
5.4127e-07, 6.9191e-06, 1.1672e-07, 1.4783e-06, 9.2845e-05, 9.8868e-03,
8.3030e-01, 6.9888e-02, 1.9524e-04, 1.2964e-02, 3.3976e-07, 1.9302e-03,
1.9643e-04, 9.5868e-07, 7.3612e-07, 3.8654e-06, 2.7651e-07, 5.8987e-05,
3.9501e-03, 2.6796e-06, 4.8326e-06, 4.8105e-05, 1.8579e-05, 1.9663e-07,
1.1442e-06, 4.2058e-05, 8.4457e-06, 4.9811e-03, 1.4540e-05, 2.6267e-05,
2.0979e-05, 5.4742e-04, 2.4037e-05, 3.6672e-05, 3.5777e-07, 2.4065e-05,
5.6699e-07, 1.9878e-06, 6.2310e-08, 1.4355e-07, 2.0988e-06, 1.1262e-07,
1.0031e-07, 1.2849e-07, 5.3104e-07, 3.5308e-08, 4.1689e-07, 2.2699e-07,
2.2900e-09, 1.2952e-08, 4.7359e-08, 8.9997e-08, 1.1326e-08, 9.8554e-09,
2.1910e-07, 1.0627e-07, 1.5832e-09, 2.7458e-08, 2.3348e-07, 3.2089e-07,
2.3553e-07, 5.0270e-07, 1.7378e-07, 1.7823e-08, 1.3587e-08, 6.6044e-08,
9.0809e-08, 1.3298e-09, 2.2759e-09, 9.0892e-09, 1.2526e-08, 7.6370e-09,
2.6513e-08, 1.7030e-07, 3.2989e-08, 7.1918e-08, 4.6442e-08, 2.5944e-07,
1.6392e-05, 2.5646e-04, 2.4833e-03, 7.6800e-05, 3.0090e-06, 5.1826e-05,
1.1265e-06, 4.7462e-07, 1.4061e-05, 4.3670e-07, 4.1302e-08, 5.4400e-06,
2.8962e-07, 1.3936e-08, 1.3944e-08, 5.9296e-07, 1.2218e-07, 3.5634e-08,
5.8646e-06, 4.4152e-08, 1.4776e-07, 3.2789e-09, 1.7723e-08, 3.1799e-07,
1.1685e-08, 1.0588e-04, 1.5348e-05, 1.3640e-06, 2.0940e-05, 3.0651e-05,
2.4482e-07, 9.4564e-06, 3.7124e-07, 1.0868e-06, 8.8361e-08, 6.2655e-08,
2.5217e-08, 1.8470e-08, 1.9936e-07, 1.7811e-08, 3.4517e-07, 1.7000e-06,
1.9770e-07, 2.0719e-06, 1.2514e-06, 6.2263e-08, 5.9024e-09, 4.7301e-06,
2.4375e-07, 1.9945e-07, 2.2064e-06, 3.2971e-07, 3.2204e-07, 1.2728e-06,
1.7046e-06, 4.6027e-09, 8.2547e-10, 1.0181e-06, 1.2746e-07, 4.5022e-07,
6.2792e-08, 7.0071e-07, 1.3727e-08, 6.5962e-08, 7.4989e-08, 1.8120e-06,
1.1253e-08, 2.4808e-08, 1.7414e-07, 6.9314e-08, 2.4229e-08, 6.0354e-07,
2.7061e-06, 4.5430e-08, 1.3682e-07, 1.7621e-07, 8.3578e-09, 4.9750e-07,
2.0484e-06, 5.1916e-07, 1.5261e-08, 1.3860e-06, 1.6236e-05, 9.2399e-07,
1.1459e-07, 3.7970e-07, 1.4329e-08, 1.8873e-07, 1.7288e-07, 6.7730e-07,
5.9125e-07, 4.4235e-07, 6.0708e-07, 1.8472e-07, 8.2659e-08, 9.2409e-07,
4.6792e-07, 3.4972e-05, 9.9547e-05, 4.5393e-06, 1.3769e-08, 1.5762e-06,
5.0675e-07, 3.4988e-08, 5.3897e-07, 1.7400e-06, 2.3352e-06, 1.5959e-06,
4.1947e-08, 2.0779e-07, 8.4712e-06, 6.4558e-07, 2.6782e-07, 1.9051e-07,
2.0012e-06, 1.6324e-07, 1.0822e-06, 6.5337e-06, 1.3561e-07, 2.2360e-07,
4.7360e-06, 1.0976e-07, 8.7181e-07, 1.9509e-07, 2.5715e-08, 1.0796e-07,
7.4702e-06, 8.9006e-06, 3.7580e-07, 1.5957e-07, 5.2289e-06, 1.0357e-06,
1.1012e-04, 5.2670e-05, 4.2434e-07, 2.1721e-07, 2.1461e-08, 8.4629e-09,
9.3324e-07, 3.7454e-06, 7.3124e-06, 3.7378e-06, 3.5296e-06, 1.1510e-07,
6.2279e-08, 9.5511e-08, 2.3855e-07, 8.9679e-07, 6.4345e-06, 4.3001e-06,
2.6086e-07, 6.8410e-08, 2.0529e-07, 9.9311e-07, 4.3039e-06, 6.4862e-07,
2.6209e-08, 7.8007e-07, 3.8681e-06, 2.8545e-05, 3.7999e-07, 1.7844e-06,
2.9170e-07, 3.4419e-07, 9.4269e-07, 1.5398e-07, 1.6389e-06, 9.3177e-08,
1.3482e-06, 4.7787e-07, 1.0066e-08, 1.9485e-06, 1.0830e-05, 4.2673e-06,
4.9004e-07, 1.1138e-06, 9.1308e-07, 9.2529e-07, 2.9936e-06, 3.0609e-08,
1.2123e-08, 1.9137e-06, 5.3054e-07, 1.1056e-06, 1.0666e-07, 4.6723e-06,
5.5198e-07, 2.6389e-08, 4.1260e-07, 6.4450e-06, 1.3940e-07, 1.3370e-07,
1.6536e-04, 2.6218e-06, 3.9410e-07, 1.7433e-07, 4.1548e-08, 2.9083e-07,
2.8496e-07, 3.0558e-07, 6.3086e-07, 2.6203e-08, 2.3569e-08, 6.0651e-07,
2.2991e-06, 4.2677e-07, 7.8955e-08, 5.0758e-06, 1.7482e-08, 6.8779e-05,
3.4251e-09, 2.2962e-07, 4.1848e-06, 1.0405e-06, 3.8210e-06, 2.4618e-06,
4.2842e-07, 6.1618e-09, 5.3948e-08, 3.5575e-07, 1.0572e-08, 9.2213e-08,
3.7167e-05, 6.3411e-07, 3.3904e-07, 3.7557e-07, 2.9412e-07, 4.8078e-06,
4.5713e-06, 1.1319e-06, 1.8600e-07, 4.7874e-07, 5.9186e-07, 9.0527e-07,
6.0906e-08, 2.6893e-08, 2.2913e-06, 9.9982e-07, 1.7304e-07, 5.0609e-07,
1.7231e-07, 4.5536e-07, 5.2733e-07, 4.9626e-06, 6.2295e-06, 2.1205e-06,
5.7065e-08, 1.1059e-06, 1.1969e-06, 8.7067e-07, 5.5700e-07, 1.7548e-06,
1.3940e-07, 2.3478e-08, 1.8630e-06, 9.3064e-07, 1.3520e-06, 1.9176e-06,
1.3583e-06, 7.8045e-07, 8.1695e-07, 2.0022e-07, 1.0841e-07, 1.4837e-07,
1.4647e-06, 5.0849e-08, 4.1064e-06, 1.2807e-06, 1.7657e-07, 9.2260e-08,
4.8354e-07, 2.5524e-06, 5.6300e-08, 4.5202e-08, 1.5991e-08, 2.8509e-07,
5.8679e-07, 2.1607e-07, 2.5374e-06, 2.8854e-07, 4.1311e-07, 1.9734e-07,
4.9488e-09, 2.0998e-06, 3.0799e-07, 1.6786e-06, 8.8315e-07, 3.2885e-07,
8.4784e-08, 9.9776e-08, 1.2368e-06, 3.3919e-05, 1.6036e-06, 3.8023e-07,
1.8997e-08, 1.6186e-07, 4.3947e-07, 3.1349e-06, 1.4959e-06, 3.8973e-06,
1.2536e-06, 3.0484e-06, 6.2363e-07, 5.8275e-07, 1.3441e-07, 2.4783e-07,
3.7679e-06, 2.0309e-06, 3.8502e-07, 2.1562e-07, 3.4836e-06, 1.5991e-06,
2.0279e-07, 2.4760e-07, 8.3103e-07, 3.0521e-07, 6.8899e-06, 1.3158e-07,
9.2566e-08, 1.2987e-07, 6.6900e-07, 2.8101e-07, 2.5624e-06, 4.6730e-05,
4.5822e-08, 1.6842e-06, 1.6064e-06, 2.8302e-05, 4.8026e-07, 1.5593e-07,
1.8008e-06, 3.3965e-07, 2.6141e-07, 8.9039e-09, 2.4791e-06, 1.7449e-07,
3.0641e-07, 8.6237e-07, 1.4638e-08, 4.3117e-07, 2.9507e-07, 9.4550e-07,
2.5855e-07, 1.3750e-06, 1.0229e-05, 3.5426e-07, 7.6847e-06, 9.0605e-07,
8.0181e-08, 6.1467e-08, 9.5402e-07, 5.3596e-07, 1.6593e-07, 6.5679e-07,
8.3473e-08, 1.5929e-06, 3.7230e-08, 6.2966e-08, 4.7281e-07, 2.4831e-07,
1.2934e-07, 1.0300e-07, 2.0521e-06, 7.8583e-07, 3.6362e-07, 3.7874e-06,
3.1836e-06, 3.0897e-07, 2.6604e-07, 2.1607e-06, 3.4649e-05, 5.0739e-07,
9.1085e-09, 2.6142e-06, 5.4483e-07, 5.4164e-08, 1.1281e-07, 9.1327e-07,
4.5163e-07, 4.3125e-07, 3.3360e-08, 7.4191e-08, 4.6817e-07, 1.2071e-07,
2.7035e-07, 3.4775e-08, 8.8645e-06, 1.0556e-06, 1.6237e-06, 2.9757e-06,
1.4359e-07, 1.3167e-06, 4.3485e-06, 2.2305e-05, 7.6890e-08, 8.5960e-07,
8.8747e-09, 3.6452e-07, 5.3267e-06, 1.5137e-07, 1.0537e-06, 6.6923e-05,
7.4396e-08, 4.8483e-05, 7.0330e-09, 6.5001e-07, 2.5980e-08, 3.2111e-07,
3.6964e-07, 1.8244e-08, 5.0944e-07, 1.5400e-07, 3.2367e-06, 1.6521e-08,
1.7036e-05, 2.6989e-07, 3.7400e-07, 6.4892e-06, 7.8334e-07, 1.4516e-05,
3.3903e-06, 3.9301e-05, 1.0771e-05, 3.1425e-06, 4.9378e-06, 8.1967e-08,
4.8106e-05, 3.5479e-07, 6.2127e-06, 3.1483e-07, 1.5537e-06, 2.0423e-05,
1.7494e-08, 9.5895e-06, 5.3306e-06, 2.9762e-06, 9.0725e-07, 2.2622e-08,
1.9300e-06, 6.1189e-07, 7.6442e-07, 2.8748e-07, 2.5639e-07, 4.8020e-08,
4.4060e-07, 7.7503e-07, 3.1007e-07, 7.0331e-07, 7.8625e-08, 9.6247e-08,
3.3385e-07, 2.7131e-07, 2.7978e-06, 1.0515e-06, 4.4754e-07, 4.9199e-07,
2.4201e-08, 2.1902e-06, 6.8253e-08, 5.6619e-08, 1.1455e-06, 1.9107e-06,
6.1120e-05, 1.5901e-06, 4.5963e-07, 2.4231e-07, 4.3908e-08, 4.5700e-06,
2.7126e-08, 6.5075e-07, 4.7211e-07, 9.4213e-08, 8.3145e-07, 1.0685e-06,
3.0158e-07, 1.4197e-05, 6.6103e-07, 3.0038e-07, 7.8213e-07, 5.7222e-08,
1.4809e-07, 8.5884e-06, 3.9222e-08, 9.5035e-07, 7.3888e-07, 4.1611e-07,
3.8056e-07, 6.5726e-06, 4.6336e-06, 1.2941e-07, 1.1257e-07, 4.0485e-07,
4.9622e-07, 1.8005e-05, 1.5965e-06, 2.2188e-06, 1.5157e-06, 1.9226e-06,
1.6532e-06, 2.0562e-08, 3.1499e-06, 8.5155e-07, 6.8987e-07, 2.0769e-05,
2.2714e-07, 2.0677e-06, 1.2234e-06, 2.9070e-06, 1.7912e-06, 6.7512e-07,
5.9088e-06, 5.4768e-07, 6.6581e-08, 7.0871e-08, 4.5414e-06, 2.8613e-06,
1.7365e-07, 1.4766e-06, 2.7468e-07, 1.1376e-06, 1.9202e-07, 2.6962e-06,
1.2406e-04, 1.5485e-07, 1.6923e-07, 1.2458e-06, 1.5717e-07, 7.8793e-09,
1.0798e-07, 4.2017e-08, 5.1216e-08, 6.5024e-07, 5.1441e-07, 4.5326e-07,
3.3495e-07, 9.3595e-09, 3.7403e-07, 1.4191e-06, 6.3541e-07, 5.5097e-07,
9.5614e-06, 2.3034e-06, 1.3032e-07, 1.5851e-08, 3.9380e-09, 4.4827e-07,
9.3790e-06, 1.0875e-07, 1.1909e-07, 1.9340e-05, 4.6176e-06, 6.1346e-07,
2.2519e-05, 2.7272e-07, 2.4799e-08, 7.8123e-08, 3.7809e-07, 2.0109e-09,
8.2828e-08, 4.2335e-07, 2.0325e-08, 9.9324e-08, 2.5617e-07, 2.9431e-07,
7.6843e-08, 1.3858e-06, 2.5660e-06, 3.0705e-06, 2.7318e-05, 1.9467e-06,
1.8253e-08, 3.0549e-07, 1.4173e-06, 3.2822e-07, 5.1450e-06, 4.5799e-07,
4.1337e-07, 2.8971e-06, 1.1367e-06, 9.5385e-07, 9.9672e-07, 9.7991e-07,
1.5353e-05, 6.7839e-07, 1.3549e-07, 9.7582e-08, 4.3272e-07, 3.1815e-09,
1.8463e-07, 3.5902e-07, 2.8727e-07, 5.1396e-08, 2.3341e-08, 4.0379e-07,
7.7843e-08, 2.6144e-08, 2.3666e-09, 3.1901e-07, 1.5370e-07, 2.7065e-05,
2.4361e-06, 2.3417e-07, 4.4093e-06, 1.0163e-08, 3.7309e-07, 1.9445e-06,
3.7269e-06, 2.0246e-06, 2.7814e-07, 1.1297e-06, 1.6989e-06, 4.5535e-08,
8.3805e-07, 6.1257e-07, 5.3641e-08, 1.6760e-08, 4.4251e-08, 8.8049e-08,
6.5732e-06, 2.4231e-06, 3.4349e-07, 2.9437e-07, 1.9981e-08, 3.2105e-07,
1.2023e-07, 3.4457e-07, 1.3067e-07, 6.8178e-07, 9.5957e-06, 1.7218e-07,
2.9186e-07, 9.8741e-07, 1.2198e-07, 5.1106e-08, 9.7978e-09, 6.3165e-08,
1.4853e-06, 3.6861e-09, 6.7289e-07, 2.1981e-06, 1.5383e-06, 3.7863e-06,
8.7545e-07, 8.8764e-09, 2.3495e-07, 9.1230e-06, 8.1576e-08, 2.9458e-06,
3.5886e-07, 1.2731e-07, 7.2442e-07, 4.9291e-07, 4.0808e-07, 3.9548e-08,
3.8268e-07, 2.9060e-07, 2.1999e-07, 3.5320e-06, 3.7342e-07, 3.1346e-08,
9.6835e-07, 8.3035e-08, 2.9030e-07, 5.2149e-10, 7.5826e-09, 3.6561e-08,
1.1612e-07, 2.2320e-08, 2.5588e-06, 1.3546e-05])
%% Cell type:code id: tags:
``` python
# We load the labels for the classes from a file
import json
class_idx = json.load(open("imagenet_class_index.json", 'r'))
idx2label = [class_idx[str(k)][1] for k in range(len(class_idx))]
```
%% Cell type:code id: tags:
``` python
idx2label
```
%%%% Output: execute_result
['tench',
'goldfish',
'great_white_shark',
'tiger_shark',
'hammerhead',
'electric_ray',
'stingray',
'cock',
'hen',
'ostrich',
'brambling',
'goldfinch',
'house_finch',
'junco',
'indigo_bunting',
'robin',
'bulbul',
'jay',
'magpie',
'chickadee',
'water_ouzel',
'kite',
'bald_eagle',
'vulture',
'great_grey_owl',
'European_fire_salamander',
'common_newt',
'eft',
'spotted_salamander',
'axolotl',
'bullfrog',
'tree_frog',
'tailed_frog',
'loggerhead',
'leatherback_turtle',
'mud_turtle',
'terrapin',
'box_turtle',
'banded_gecko',
'common_iguana',
'American_chameleon',
'whiptail',
'agama',
'frilled_lizard',
'alligator_lizard',
'Gila_monster',
'green_lizard',
'African_chameleon',
'Komodo_dragon',
'African_crocodile',
'American_alligator',
'triceratops',
'thunder_snake',
'ringneck_snake',
'hognose_snake',
'green_snake',
'king_snake',
'garter_snake',
'water_snake',
'vine_snake',
'night_snake',
'boa_constrictor',
'rock_python',
'Indian_cobra',
'green_mamba',
'sea_snake',
'horned_viper',
'diamondback',
'sidewinder',
'trilobite',
'harvestman',
'scorpion',
'black_and_gold_garden_spider',
'barn_spider',
'garden_spider',
'black_widow',
'tarantula',
'wolf_spider',
'tick',
'centipede',
'black_grouse',
'ptarmigan',
'ruffed_grouse',
'prairie_chicken',
'peacock',
'quail',
'partridge',
'African_grey',
'macaw',
'sulphur-crested_cockatoo',
'lorikeet',
'coucal',
'bee_eater',
'hornbill',
'hummingbird',
'jacamar',
'toucan',
'drake',
'red-breasted_merganser',
'goose',
'black_swan',
'tusker',
'echidna',
'platypus',
'wallaby',
'koala',
'wombat',
'jellyfish',
'sea_anemone',
'brain_coral',
'flatworm',
'nematode',
'conch',
'snail',
'slug',
'sea_slug',
'chiton',
'chambered_nautilus',
'Dungeness_crab',
'rock_crab',
'fiddler_crab',
'king_crab',
'American_lobster',
'spiny_lobster',
'crayfish',
'hermit_crab',
'isopod',
'white_stork',
'black_stork',
'spoonbill',
'flamingo',
'little_blue_heron',
'American_egret',
'bittern',
'crane',
'limpkin',
'European_gallinule',
'American_coot',
'bustard',
'ruddy_turnstone',
'red-backed_sandpiper',
'redshank',
'dowitcher',
'oystercatcher',
'pelican',
'king_penguin',
'albatross',
'grey_whale',
'killer_whale',
'dugong',
'sea_lion',
'Chihuahua',
'Japanese_spaniel',
'Maltese_dog',
'Pekinese',
'Shih-Tzu',
'Blenheim_spaniel',
'papillon',
'toy_terrier',
'Rhodesian_ridgeback',
'Afghan_hound',
'basset',
'beagle',
'bloodhound',
'bluetick',
'black-and-tan_coonhound',
'Walker_hound',
'English_foxhound',
'redbone',
'borzoi',
'Irish_wolfhound',
'Italian_greyhound',
'whippet',
'Ibizan_hound',
'Norwegian_elkhound',
'otterhound',
'Saluki',
'Scottish_deerhound',
'Weimaraner',
'Staffordshire_bullterrier',
'American_Staffordshire_terrier',
'Bedlington_terrier',
'Border_terrier',
'Kerry_blue_terrier',
'Irish_terrier',
'Norfolk_terrier',
'Norwich_terrier',
'Yorkshire_terrier',
'wire-haired_fox_terrier',
'Lakeland_terrier',
'Sealyham_terrier',
'Airedale',
'cairn',
'Australian_terrier',
'Dandie_Dinmont',
'Boston_bull',
'miniature_schnauzer',
'giant_schnauzer',
'standard_schnauzer',
'Scotch_terrier',
'Tibetan_terrier',
'silky_terrier',
'soft-coated_wheaten_terrier',
'West_Highland_white_terrier',
'Lhasa',
'flat-coated_retriever',
'curly-coated_retriever',
'golden_retriever',
'Labrador_retriever',
'Chesapeake_Bay_retriever',
'German_short-haired_pointer',
'vizsla',
'English_setter',
'Irish_setter',
'Gordon_setter',
'Brittany_spaniel',
'clumber',
'English_springer',
'Welsh_springer_spaniel',
'cocker_spaniel',
'Sussex_spaniel',
'Irish_water_spaniel',
'kuvasz',
'schipperke',
'groenendael',
'malinois',
'briard',
'kelpie',
'komondor',
'Old_English_sheepdog',
'Shetland_sheepdog',
'collie',
'Border_collie',
'Bouvier_des_Flandres',
'Rottweiler',
'German_shepherd',
'Doberman',
'miniature_pinscher',
'Greater_Swiss_Mountain_dog',
'Bernese_mountain_dog',
'Appenzeller',
'EntleBucher',
'boxer',
'bull_mastiff',
'Tibetan_mastiff',
'French_bulldog',
'Great_Dane',
'Saint_Bernard',
'Eskimo_dog',
'malamute',
'Siberian_husky',
'dalmatian',
'affenpinscher',
'basenji',
'pug',
'Leonberg',
'Newfoundland',
'Great_Pyrenees',
'Samoyed',
'Pomeranian',
'chow',
'keeshond',
'Brabancon_griffon',
'Pembroke',
'Cardigan',
'toy_poodle',
'miniature_poodle',
'standard_poodle',
'Mexican_hairless',
'timber_wolf',
'white_wolf',
'red_wolf',
'coyote',
'dingo',
'dhole',
'African_hunting_dog',
'hyena',
'red_fox',
'kit_fox',
'Arctic_fox',
'grey_fox',
'tabby',
'tiger_cat',
'Persian_cat',
'Siamese_cat',
'Egyptian_cat',
'cougar',
'lynx',
'leopard',
'snow_leopard',
'jaguar',
'lion',
'tiger',
'cheetah',
'brown_bear',
'American_black_bear',
'ice_bear',
'sloth_bear',
'mongoose',
'meerkat',
'tiger_beetle',
'ladybug',
'ground_beetle',
'long-horned_beetle',
'leaf_beetle',
'dung_beetle',
'rhinoceros_beetle',
'weevil',
'fly',
'bee',
'ant',
'grasshopper',
'cricket',
'walking_stick',
'cockroach',
'mantis',
'cicada',
'leafhopper',
'lacewing',
'dragonfly',
'damselfly',
'admiral',
'ringlet',
'monarch',
'cabbage_butterfly',
'sulphur_butterfly',
'lycaenid',
'starfish',
'sea_urchin',
'sea_cucumber',
'wood_rabbit',
'hare',
'Angora',
'hamster',
'porcupine',
'fox_squirrel',
'marmot',
'beaver',
'guinea_pig',
'sorrel',
'zebra',
'hog',
'wild_boar',
'warthog',
'hippopotamus',
'ox',
'water_buffalo',
'bison',
'ram',
'bighorn',
'ibex',
'hartebeest',
'impala',
'gazelle',
'Arabian_camel',
'llama',
'weasel',
'mink',
'polecat',
'black-footed_ferret',
'otter',
'skunk',
'badger',
'armadillo',
'three-toed_sloth',
'orangutan',
'gorilla',
'chimpanzee',
'gibbon',
'siamang',
'guenon',
'patas',
'baboon',
'macaque',
'langur',
'colobus',
'proboscis_monkey',
'marmoset',
'capuchin',
'howler_monkey',
'titi',
'spider_monkey',
'squirrel_monkey',
'Madagascar_cat',
'indri',
'Indian_elephant',
'African_elephant',
'lesser_panda',
'giant_panda',
'barracouta',
'eel',
'coho',
'rock_beauty',
'anemone_fish',
'sturgeon',
'gar',
'lionfish',
'puffer',
'abacus',
'abaya',
'academic_gown',
'accordion',
'acoustic_guitar',
'aircraft_carrier',
'airliner',
'airship',
'altar',
'ambulance',
'amphibian',
'analog_clock',
'apiary',
'apron',
'ashcan',
'assault_rifle',
'backpack',
'bakery',
'balance_beam',
'balloon',
'ballpoint',
'Band_Aid',
'banjo',
'bannister',
'barbell',
'barber_chair',
'barbershop',
'barn',
'barometer',
'barrel',
'barrow',
'baseball',
'basketball',
'bassinet',
'bassoon',
'bathing_cap',
'bath_towel',
'bathtub',
'beach_wagon',
'beacon',
'beaker',
'bearskin',
'beer_bottle',
'beer_glass',
'bell_cote',
'bib',
'bicycle-built-for-two',
'bikini',
'binder',
'binoculars',
'birdhouse',
'boathouse',
'bobsled',
'bolo_tie',
'bonnet',
'bookcase',
'bookshop',
'bottlecap',
'bow',
'bow_tie',
'brass',
'brassiere',
'breakwater',
'breastplate',
'broom',
'bucket',
'buckle',
'bulletproof_vest',
'bullet_train',
'butcher_shop',
'cab',
'caldron',
'candle',
'cannon',
'canoe',
'can_opener',
'cardigan',
'car_mirror',
'carousel',
"carpenter's_kit",
'carton',
'car_wheel',
'cash_machine',
'cassette',
'cassette_player',
'castle',
'catamaran',
'CD_player',
'cello',
'cellular_telephone',
'chain',
'chainlink_fence',
'chain_mail',
'chain_saw',
'chest',
'chiffonier',
'chime',
'china_cabinet',
'Christmas_stocking',
'church',
'cinema',
'cleaver',
'cliff_dwelling',
'cloak',
'clog',
'cocktail_shaker',
'coffee_mug',
'coffeepot',
'coil',
'combination_lock',
'computer_keyboard',
'confectionery',
'container_ship',
'convertible',
'corkscrew',
'cornet',
'cowboy_boot',
'cowboy_hat',
'cradle',
'crane',
'crash_helmet',
'crate',
'crib',
'Crock_Pot',
'croquet_ball',
'crutch',
'cuirass',
'dam',
'desk',
'desktop_computer',
'dial_telephone',
'diaper',
'digital_clock',
'digital_watch',
'dining_table',
'dishrag',
'dishwasher',
'disk_brake',
'dock',
'dogsled',
'dome',
'doormat',
'drilling_platform',
'drum',
'drumstick',
'dumbbell',
'Dutch_oven',
'electric_fan',
'electric_guitar',
'electric_locomotive',
'entertainment_center',
'envelope',
'espresso_maker',
'face_powder',
'feather_boa',
'file',
'fireboat',
'fire_engine',
'fire_screen',
'flagpole',
'flute',
'folding_chair',
'football_helmet',
'forklift',
'fountain',
'fountain_pen',
'four-poster',
'freight_car',
'French_horn',
'frying_pan',
'fur_coat',
'garbage_truck',
'gasmask',
'gas_pump',
'goblet',
'go-kart',
'golf_ball',
'golfcart',
'gondola',
'gong',
'gown',
'grand_piano',
'greenhouse',
'grille',
'grocery_store',
'guillotine',
'hair_slide',
'hair_spray',
'half_track',
'hammer',
'hamper',
'hand_blower',
'hand-held_computer',
'handkerchief',
'hard_disc',
'harmonica',
'harp',
'harvester',
'hatchet',
'holster',
'home_theater',
'honeycomb',
'hook',
'hoopskirt',
'horizontal_bar',
'horse_cart',
'hourglass',
'iPod',
'iron',
"jack-o'-lantern",
'jean',
'jeep',
'jersey',
'jigsaw_puzzle',
'jinrikisha',
'joystick',
'kimono',
'knee_pad',
'knot',
'lab_coat',
'ladle',
'lampshade',
'laptop',
'lawn_mower',
'lens_cap',
'letter_opener',
'library',
'lifeboat',
'lighter',
'limousine',
'liner',
'lipstick',
'Loafer',
'lotion',
'loudspeaker',
'loupe',
'lumbermill',
'magnetic_compass',
'mailbag',
'mailbox',
'maillot',
'maillot',
'manhole_cover',
'maraca',
'marimba',
'mask',
'matchstick',
'maypole',
'maze',
'measuring_cup',
'medicine_chest',
'megalith',
'microphone',
'microwave',
'military_uniform',
'milk_can',
'minibus',
'miniskirt',
'minivan',
'missile',
'mitten',
'mixing_bowl',
'mobile_home',
'Model_T',
'modem',
'monastery',
'monitor',
'moped',
'mortar',
'mortarboard',
'mosque',
'mosquito_net',
'motor_scooter',
'mountain_bike',
'mountain_tent',
'mouse',
'mousetrap',
'moving_van',
'muzzle',
'nail',
'neck_brace',
'necklace',
'nipple',
'notebook',
'obelisk',
'oboe',
'ocarina',
'odometer',
'oil_filter',
'organ',
'oscilloscope',
'overskirt',
'oxcart',
'oxygen_mask',
'packet',
'paddle',
'paddlewheel',
'padlock',
'paintbrush',
'pajama',
'palace',
'panpipe',
'paper_towel',
'parachute',
'parallel_bars',
'park_bench',
'parking_meter',
'passenger_car',
'patio',
'pay-phone',
'pedestal',
'pencil_box',
'pencil_sharpener',
'perfume',
'Petri_dish',
'photocopier',
'pick',
'pickelhaube',
'picket_fence',
'pickup',
'pier',
'piggy_bank',
'pill_bottle',
'pillow',
'ping-pong_ball',
'pinwheel',
'pirate',
'pitcher',
'plane',
'planetarium',
'plastic_bag',
'plate_rack',
'plow',
'plunger',
'Polaroid_camera',
'pole',
'police_van',
'poncho',
'pool_table',
'pop_bottle',
'pot',
"potter's_wheel",
'power_drill',
'prayer_rug',
'printer',