├── .gitignore ├── stop.jpg ├── poodle.png ├── weasel.png ├── caffe_classes.pyc ├── construction.jpg ├── README.md ├── signnames.csv ├── traffic_sign_inference_solution.py ├── imagenet_inference.py ├── traffic_sign_inference.py ├── feature_extraction_solution.py ├── feature_extraction.py ├── training_output.txt ├── train_feature_extraction_solution.py ├── train_feature_extraction.py ├── alexnet.py └── caffe_classes.py /.gitignore: -------------------------------------------------------------------------------- 1 | .ipynb_checkpoints 2 | __pycache__ 3 | bvlc-alexnet.npy 4 | train.p 5 | .vscode -------------------------------------------------------------------------------- /stop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimoralea/alexnet-feature-extraction/master/stop.jpg -------------------------------------------------------------------------------- /poodle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimoralea/alexnet-feature-extraction/master/poodle.png -------------------------------------------------------------------------------- /weasel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimoralea/alexnet-feature-extraction/master/weasel.png -------------------------------------------------------------------------------- /caffe_classes.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimoralea/alexnet-feature-extraction/master/caffe_classes.pyc -------------------------------------------------------------------------------- /construction.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mimoralea/alexnet-feature-extraction/master/construction.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AlexNet Feature Extraction 2 | This lab guides you through using AlexNet and TensorFlow to build a feature extraction network. 3 | 4 | ## Setup 5 | Before you start the lab, you should first install: 6 | * Python 3 7 | * TensorFlow 8 | * NumPy 9 | * SciPy 10 | * matplotlib 11 | 12 | -------------------------------------------------------------------------------- /signnames.csv: -------------------------------------------------------------------------------- 1 | ClassId,SignName 2 | 0,Speed limit (20km/h) 3 | 1,Speed limit (30km/h) 4 | 2,Speed limit (50km/h) 5 | 3,Speed limit (60km/h) 6 | 4,Speed limit (70km/h) 7 | 5,Speed limit (80km/h) 8 | 6,End of speed limit (80km/h) 9 | 7,Speed limit (100km/h) 10 | 8,Speed limit (120km/h) 11 | 9,No passing 12 | 10,No passing for vechiles over 3.5 metric tons 13 | 11,Right-of-way at the next intersection 14 | 12,Priority road 15 | 13,Yield 16 | 14,Stop 17 | 15,No vechiles 18 | 16,Vechiles over 3.5 metric tons prohibited 19 | 17,No entry 20 | 18,General caution 21 | 19,Dangerous curve to the left 22 | 20,Dangerous curve to the right 23 | 21,Double curve 24 | 22,Bumpy road 25 | 23,Slippery road 26 | 24,Road narrows on the right 27 | 25,Road work 28 | 26,Traffic signals 29 | 27,Pedestrians 30 | 28,Children crossing 31 | 29,Bicycles crossing 32 | 30,Beware of ice/snow 33 | 31,Wild animals crossing 34 | 32,End of all speed and passing limits 35 | 33,Turn right ahead 36 | 34,Turn left ahead 37 | 35,Ahead only 38 | 36,Go straight or right 39 | 37,Go straight or left 40 | 38,Keep right 41 | 39,Keep left 42 | 40,Roundabout mandatory 43 | 41,End of no passing 44 | 42,End of no passing by vechiles over 3.5 metric tons 45 | -------------------------------------------------------------------------------- /traffic_sign_inference_solution.py: -------------------------------------------------------------------------------- 1 | """ 2 | The traffic signs are 32x32 so you 3 | have to resize them to be 227x227 before 4 | passing them to AlexNet. 5 | """ 6 | import time 7 | import tensorflow as tf 8 | import numpy as np 9 | from scipy.misc import imread 10 | from caffe_classes import class_names 11 | from alexnet import AlexNet 12 | 13 | 14 | # placeholders 15 | x = tf.placeholder(tf.float32, (None, 32, 32, 3)) 16 | resized = tf.image.resize_images(x, (227, 227)) 17 | 18 | probs = AlexNet(resized) 19 | init = tf.initialize_all_variables() 20 | sess = tf.Session() 21 | sess.run(init) 22 | 23 | # Read Images 24 | im1 = imread("construction.jpg").astype(np.float32) 25 | im1 = im1 - np.mean(im1) 26 | 27 | im2 = imread("stop.jpg").astype(np.float32) 28 | im2 = im2 - np.mean(im2) 29 | 30 | # Run Inference 31 | t = time.time() 32 | output = sess.run(probs, feed_dict={x: [im1, im2]}) 33 | 34 | # Print Output 35 | for input_im_ind in range(output.shape[0]): 36 | inds = np.argsort(output)[input_im_ind, :] 37 | print("Image", input_im_ind) 38 | for i in range(5): 39 | print("%s: %.3f" % (class_names[inds[-1 - i]], output[input_im_ind, inds[-1 - i]])) 40 | print() 41 | 42 | print("Time: %.3f seconds" % (time.time() - t)) 43 | -------------------------------------------------------------------------------- /imagenet_inference.py: -------------------------------------------------------------------------------- 1 | # NOTE: You don't need to edit this code. 2 | import time 3 | import tensorflow as tf 4 | import numpy as np 5 | from scipy.misc import imread 6 | from caffe_classes import class_names 7 | from alexnet import AlexNet 8 | 9 | 10 | # placeholders 11 | x = tf.placeholder(tf.float32, (None, 227, 227, 3)) 12 | 13 | # By keeping `feature_extract` set to `False` 14 | # we indicate to keep the 1000 class final layer 15 | # originally used to train on ImageNet. 16 | probs = AlexNet(x, feature_extract=False) 17 | init = tf.initialize_all_variables() 18 | sess = tf.Session() 19 | sess.run(init) 20 | 21 | # Read Images 22 | im1 = (imread("poodle.png")[:, :, :3]).astype(np.float32) 23 | im1 = im1 - np.mean(im1) 24 | 25 | im2 = (imread("weasel.png")[:, :, :3]).astype(np.float32) 26 | im2 = im2 - np.mean(im2) 27 | 28 | # Run Inference 29 | t = time.time() 30 | output = sess.run(probs, feed_dict={x: [im1, im2]}) 31 | 32 | # Print Output 33 | for input_im_ind in range(output.shape[0]): 34 | inds = np.argsort(output)[input_im_ind, :] 35 | print("Image", input_im_ind) 36 | for i in range(5): 37 | print("%s: %.3f" % (class_names[inds[-1 - i]], output[input_im_ind, inds[-1 - i]])) 38 | print() 39 | 40 | print("Time: %.3f seconds" % (time.time() - t)) 41 | -------------------------------------------------------------------------------- /traffic_sign_inference.py: -------------------------------------------------------------------------------- 1 | """ 2 | The traffic signs are 32x32 so you 3 | have to resize them to be 227x227 before 4 | passing them to AlexNet. 5 | """ 6 | import time 7 | import tensorflow as tf 8 | import numpy as np 9 | from scipy.misc import imread 10 | from caffe_classes import class_names 11 | from alexnet import AlexNet 12 | 13 | x = tf.placeholder(tf.float32, (None, 32, 32, 3)) 14 | # TODO: Resize the images so they can be fed into AlexNet. 15 | # HINT: Use `tf.image.resize_images` to resize the images 16 | resized = tf.image.resize_images(x, (227, 227)) 17 | 18 | probs = AlexNet(resized) 19 | 20 | init = tf.initialize_all_variables() 21 | sess = tf.Session() 22 | sess.run(init) 23 | 24 | # Read Images 25 | im1 = imread("construction.jpg").astype(np.float32) 26 | im1 = im1 - np.mean(im1) 27 | 28 | im2 = imread("stop.jpg").astype(np.float32) 29 | im2 = im2 - np.mean(im2) 30 | 31 | # Run Inference 32 | t = time.time() 33 | output = sess.run(probs, feed_dict={x: [im1, im2]}) 34 | 35 | # Print Output 36 | for input_im_ind in range(output.shape[0]): 37 | inds = np.argsort(output)[input_im_ind, :] 38 | print("Image", input_im_ind) 39 | for i in range(5): 40 | print("%s: %.3f" % (class_names[inds[-1 - i]], output[input_im_ind, inds[-1 - i]])) 41 | print() 42 | 43 | print("Time: %.3f seconds" % (time.time() - t)) 44 | -------------------------------------------------------------------------------- /feature_extraction_solution.py: -------------------------------------------------------------------------------- 1 | import time 2 | import tensorflow as tf 3 | import numpy as np 4 | import pandas as pd 5 | from scipy.misc import imread 6 | from alexnet import AlexNet 7 | 8 | sign_names = pd.read_csv('signnames.csv') 9 | nb_classes = 43 10 | 11 | x = tf.placeholder(tf.float32, (None, 32, 32, 3)) 12 | resized = tf.image.resize_images(x, (227, 227)) 13 | 14 | # Returns the second final layer of the AlexNet model, 15 | # this allows us to redo the last layer for the specifically for 16 | # traffic signs model. 17 | fc7 = AlexNet(resized, feature_extract=True) 18 | shape = (fc7.get_shape().as_list()[-1], nb_classes) 19 | fc8W = tf.Variable(tf.truncated_normal(shape, stddev=1e-2)) 20 | fc8b = tf.Variable(tf.zeros(nb_classes)) 21 | logits = tf.nn.xw_plus_b(fc7, fc8W, fc8b) 22 | probs = tf.nn.softmax(logits) 23 | 24 | init = tf.initialize_all_variables() 25 | sess = tf.Session() 26 | sess.run(init) 27 | 28 | # Read Images 29 | im1 = imread("construction.jpg").astype(np.float32) 30 | im1 = im1 - np.mean(im1) 31 | 32 | im2 = imread("stop.jpg").astype(np.float32) 33 | im2 = im2 - np.mean(im2) 34 | 35 | # Run Inference 36 | t = time.time() 37 | output = sess.run(probs, feed_dict={x: [im1, im2]}) 38 | 39 | # Print Output 40 | for input_im_ind in range(output.shape[0]): 41 | inds = np.argsort(output)[input_im_ind, :] 42 | print("Image", input_im_ind) 43 | for i in range(5): 44 | print("%s: %.3f" % (sign_names.ix[inds[-1 - i]][1], output[input_im_ind, inds[-1 - i]])) 45 | print() 46 | 47 | print("Time: %.3f seconds" % (time.time() - t)) 48 | -------------------------------------------------------------------------------- /feature_extraction.py: -------------------------------------------------------------------------------- 1 | import time 2 | import tensorflow as tf 3 | import numpy as np 4 | import pandas as pd 5 | from scipy.misc import imread 6 | from alexnet import AlexNet 7 | 8 | sign_names = pd.read_csv('signnames.csv') 9 | nb_classes = 43 10 | 11 | x = tf.placeholder(tf.float32, (None, 32, 32, 3)) 12 | resized = tf.image.resize_images(x, (227, 227)) 13 | 14 | # NOTE: By setting `feature_extract` to `True` we return 15 | # the second to last layer. 16 | fc7 = AlexNet(resized, feature_extract=True) 17 | # TODO: Define a new fully connected layer followed by a softmax activation to classify 18 | # the traffic signs. Assign the result of the softmax activation to `probs` below. 19 | shape = (fc7.get_shape().as_list()[-1], nb_classes) # use this shape for the weight matrix 20 | fc8W = tf.Variable(tf.truncated_normal(shape, stddev=1e-2)) 21 | fc8b = tf.Variable(tf.zeros(nb_classes)) 22 | logits = tf.nn.xw_plus_b(fc7, fc8W, fc8b) 23 | probs = tf.nn.softmax(logits) 24 | 25 | init = tf.initialize_all_variables() 26 | sess = tf.Session() 27 | sess.run(init) 28 | 29 | # Read Images 30 | im1 = imread("construction.jpg").astype(np.float32) 31 | im1 = im1 - np.mean(im1) 32 | 33 | im2 = imread("stop.jpg").astype(np.float32) 34 | im2 = im2 - np.mean(im2) 35 | 36 | # Run Inference 37 | t = time.time() 38 | output = sess.run(probs, feed_dict={x: [im1, im2]}) 39 | 40 | # Print Output 41 | for input_im_ind in range(output.shape[0]): 42 | inds = np.argsort(output)[input_im_ind, :] 43 | print("Image", input_im_ind) 44 | for i in range(5): 45 | print("%s: %.3f" % (sign_names.ix[inds[-1 - i]][1], output[input_im_ind, inds[-1 - i]])) 46 | print() 47 | 48 | print("Time: %.3f seconds" % (time.time() - t)) 49 | -------------------------------------------------------------------------------- /training_output.txt: -------------------------------------------------------------------------------- 1 | I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally 2 | I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally 3 | I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally 4 | I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally 5 | I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally 6 | I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 7 | I tensorflow/core/common_runtime/gpu/gpu_device.cc:951] Found device 0 with properties: 8 | name: TITAN X (Pascal) 9 | major: 6 minor: 1 memoryClockRate (GHz) 1.531 10 | pciBusID 0000:01:00.0 11 | Total memory: 11.90GiB 12 | Free memory: 11.32GiB 13 | I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0 14 | I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0: Y 15 | I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: TITAN X (Pascal), pci bus id: 0000:01:00.0) 16 | Epoch 1 17 | Time: 29.914 seconds 18 | Validation Loss = 0.470700512167 19 | Validation Accuracy = 0.880546771883 20 | 21 | Epoch 2 22 | Time: 29.374 seconds 23 | Validation Loss = 0.308856698107 24 | Validation Accuracy = 0.918698358132 25 | 26 | Epoch 3 27 | Time: 30.069 seconds 28 | Validation Loss = 0.238977819705 29 | Validation Accuracy = 0.939610323662 30 | 31 | Epoch 4 32 | Time: 29.257 seconds 33 | Validation Loss = 0.203365511003 34 | Validation Accuracy = 0.947159033046 35 | 36 | Epoch 5 37 | Time: 29.305 seconds 38 | Validation Loss = 0.174945230048 39 | Validation Accuracy = 0.952463531961 40 | 41 | Epoch 6 42 | Time: 29.428 seconds 43 | Validation Loss = 0.147907046261 44 | Validation Accuracy = 0.962154442615 45 | 46 | Epoch 7 47 | Time: 29.496 seconds 48 | Validation Loss = 0.133483801297 49 | Validation Accuracy = 0.966234826268 50 | 51 | Epoch 8 52 | Time: 29.591 seconds 53 | Validation Loss = 0.123730212181 54 | Validation Accuracy = 0.967152912666 55 | 56 | Epoch 9 57 | Time: 29.452 seconds 58 | Validation Loss = 0.116722132164 59 | Validation Accuracy = 0.970519228905 60 | 61 | Epoch 10 62 | Time: 29.275 seconds 63 | Validation Loss = 0.113099755518 64 | Validation Accuracy = 0.968785065991 65 | -------------------------------------------------------------------------------- /train_feature_extraction_solution.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | import time 3 | import tensorflow as tf 4 | from sklearn.model_selection import train_test_split 5 | from sklearn.utils import shuffle 6 | 7 | from alexnet import AlexNet 8 | 9 | nb_classes = 43 10 | epochs = 10 11 | batch_size = 128 12 | 13 | with open('./train.p', 'rb') as f: 14 | data = pickle.load(f) 15 | 16 | X_train, X_val, y_train, y_val = train_test_split(data['features'], data['labels'], test_size=0.33, random_state=0) 17 | 18 | features = tf.placeholder(tf.float32, (None, 32, 32, 3)) 19 | labels = tf.placeholder(tf.int64, None) 20 | resized = tf.image.resize_images(features, (227, 227)) 21 | 22 | # Returns the second final layer of the AlexNet model, 23 | # this allows us to redo the last layer for the traffic signs 24 | # model. 25 | fc7 = AlexNet(resized, feature_extract=True) 26 | fc7 = tf.stop_gradient(fc7) 27 | shape = (fc7.get_shape().as_list()[-1], nb_classes) 28 | fc8W = tf.Variable(tf.truncated_normal(shape, stddev=1e-2)) 29 | fc8b = tf.Variable(tf.zeros(nb_classes)) 30 | logits = tf.nn.xw_plus_b(fc7, fc8W, fc8b) 31 | 32 | cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(logits, labels) 33 | loss_op = tf.reduce_mean(cross_entropy) 34 | opt = tf.train.AdamOptimizer() 35 | train_op = opt.minimize(loss_op, var_list=[fc8W, fc8b]) 36 | init_op = tf.initialize_all_variables() 37 | 38 | preds = tf.arg_max(logits, 1) 39 | accuracy_op = tf.reduce_mean(tf.cast(tf.equal(preds, labels), tf.float32)) 40 | 41 | 42 | def eval_on_data(X, y, sess): 43 | total_acc = 0 44 | total_loss = 0 45 | for offset in range(0, X.shape[0], batch_size): 46 | end = offset + batch_size 47 | X_batch = X[offset:end] 48 | y_batch = y[offset:end] 49 | 50 | loss, acc = sess.run([loss_op, accuracy_op], feed_dict={features: X_batch, labels: y_batch}) 51 | total_loss += (loss * X_batch.shape[0]) 52 | total_acc += (acc * X_batch.shape[0]) 53 | 54 | return total_loss/X.shape[0], total_acc/X.shape[0] 55 | 56 | with tf.Session() as sess: 57 | sess.run(init_op) 58 | 59 | for i in range(epochs): 60 | # training 61 | X_train, y_train = shuffle(X_train, y_train) 62 | t0 = time.time() 63 | for offset in range(0, X_train.shape[0], batch_size): 64 | end = offset + batch_size 65 | sess.run(train_op, feed_dict={features: X_train[offset:end], labels: y_train[offset:end]}) 66 | 67 | val_loss, val_acc = eval_on_data(X_val, y_val, sess) 68 | print("Epoch", i+1) 69 | print("Time: %.3f seconds" % (time.time() - t0)) 70 | print("Validation Loss =", val_loss) 71 | print("Validation Accuracy =", val_acc) 72 | print("") 73 | -------------------------------------------------------------------------------- /train_feature_extraction.py: -------------------------------------------------------------------------------- 1 | import time 2 | import pickle 3 | import tensorflow as tf 4 | from sklearn.model_selection import train_test_split 5 | from alexnet import AlexNet 6 | from sklearn.utils import shuffle 7 | 8 | nb_classes = 43 9 | epochs = 10 10 | batch_size = 128 11 | 12 | # Load traffic signs data. 13 | with open('train.p', 'rb') as f: 14 | train = pickle.load(f) 15 | 16 | # data into training and validation sets. 17 | X_train, Y_train = train['features'].astype('float32'), train['labels'].astype('float32') 18 | 19 | X_train, X_val, y_train, y_val = train_test_split(X_train, 20 | Y_train, 21 | test_size=0.25, 22 | random_state=123) 23 | 24 | # Define placeholders and resize operation. 25 | features = tf.placeholder(tf.float32, (None, 32, 32, 3)) 26 | labels = tf.placeholder(tf.int64, None) 27 | resized = tf.image.resize_images(features, (227, 227)) 28 | 29 | # pass placeholder as first argument to `AlexNet`. 30 | fc7 = AlexNet(resized, feature_extract=True) 31 | 32 | # NOTE: `tf.stop_gradient` prevents the gradient from flowing backwards 33 | fc7 = tf.stop_gradient(fc7) 34 | 35 | # Add the final layer for traffic sign classification. 36 | shape = (fc7.get_shape().as_list()[-1], nb_classes) 37 | fc8W = tf.Variable(tf.truncated_normal(shape, stddev=1e-2)) 38 | fc8b = tf.Variable(tf.zeros(nb_classes)) 39 | logits = tf.nn.xw_plus_b(fc7, fc8W, fc8b) 40 | 41 | # Define loss, training, accuracy operations. 42 | # HINT: Look back at your traffic signs project solution, you may 43 | # be able to reuse some the code. 44 | cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(logits, labels) 45 | loss_op = tf.reduce_mean(cross_entropy) 46 | opt = tf.train.AdamOptimizer() 47 | train_op = opt.minimize(loss_op, var_list=[fc8W, fc8b]) 48 | init_op = tf.initialize_all_variables() 49 | 50 | # Train and evaluate the feature extraction model. 51 | preds = tf.arg_max(logits, 1) 52 | accuracy_op = tf.reduce_mean(tf.cast(tf.equal(preds, labels), tf.float32)) 53 | 54 | def eval_on_data(X, y, sess): 55 | total_acc = 0 56 | total_loss = 0 57 | for offset in range(0, X.shape[0], batch_size): 58 | end = offset + batch_size 59 | X_batch = X[offset:end] 60 | y_batch = y[offset:end] 61 | 62 | loss, acc = sess.run([loss_op, accuracy_op], feed_dict={features: X_batch, labels: y_batch}) 63 | total_loss += (loss * X_batch.shape[0]) 64 | total_acc += (acc * X_batch.shape[0]) 65 | 66 | return total_loss/X.shape[0], total_acc/X.shape[0] 67 | 68 | with tf.Session() as sess: 69 | sess.run(init_op) 70 | 71 | for i in range(epochs): 72 | # training 73 | X_train, y_train = shuffle(X_train, y_train) 74 | t0 = time.time() 75 | for offset in range(0, X_train.shape[0], batch_size): 76 | end = offset + batch_size 77 | sess.run(train_op, feed_dict={features: X_train[offset:end], labels: y_train[offset:end]}) 78 | 79 | val_loss, val_acc = eval_on_data(X_val, y_val, sess) 80 | print("Epoch", i+1) 81 | print("Time: %.3f seconds" % (time.time() - t0)) 82 | print("Validation Loss =", val_loss) 83 | print("Validation Accuracy =", val_acc) 84 | print("") 85 | -------------------------------------------------------------------------------- /alexnet.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import tensorflow as tf 3 | 4 | net_data = np.load("bvlc-alexnet.npy", encoding="latin1").item() 5 | 6 | 7 | def conv(input, kernel, biases, k_h, k_w, c_o, s_h, s_w, padding="VALID", group=1): 8 | ''' 9 | From https://github.com/ethereon/caffe-tensorflow 10 | ''' 11 | c_i = input.get_shape()[-1] 12 | assert c_i % group == 0 13 | assert c_o % group == 0 14 | convolve = lambda i, k: tf.nn.conv2d(i, k, [1, s_h, s_w, 1], padding=padding) 15 | 16 | if group == 1: 17 | conv = convolve(input, kernel) 18 | else: 19 | input_groups = tf.split(3, group, input) 20 | kernel_groups = tf.split(3, group, kernel) 21 | output_groups = [convolve(i, k) for i, k in zip(input_groups, kernel_groups)] 22 | conv = tf.concat(3, output_groups) 23 | return tf.reshape(tf.nn.bias_add(conv, biases), [-1] + conv.get_shape().as_list()[1:]) 24 | 25 | 26 | def AlexNet(features, feature_extract=False): 27 | """ 28 | Builds an AlexNet model, loads pretrained weights 29 | """ 30 | # conv1 31 | # conv(11, 11, 96, 4, 4, padding='VALID', name='conv1') 32 | k_h = 11 33 | k_w = 11 34 | c_o = 96 35 | s_h = 4 36 | s_w = 4 37 | conv1W = tf.Variable(net_data["conv1"][0]) 38 | conv1b = tf.Variable(net_data["conv1"][1]) 39 | conv1_in = conv(features, conv1W, conv1b, k_h, k_w, c_o, s_h, s_w, padding="SAME", group=1) 40 | conv1 = tf.nn.relu(conv1_in) 41 | 42 | # lrn1 43 | # lrn(2, 2e-05, 0.75, name='norm1') 44 | radius = 2 45 | alpha = 2e-05 46 | beta = 0.75 47 | bias = 1.0 48 | lrn1 = tf.nn.local_response_normalization(conv1, depth_radius=radius, alpha=alpha, beta=beta, bias=bias) 49 | 50 | # maxpool1 51 | # max_pool(3, 3, 2, 2, padding='VALID', name='pool1') 52 | k_h = 3 53 | k_w = 3 54 | s_h = 2 55 | s_w = 2 56 | padding = 'VALID' 57 | maxpool1 = tf.nn.max_pool(lrn1, ksize=[1, k_h, k_w, 1], strides=[1, s_h, s_w, 1], padding=padding) 58 | 59 | # conv2 60 | # conv(5, 5, 256, 1, 1, group=2, name='conv2') 61 | k_h = 5 62 | k_w = 5 63 | c_o = 256 64 | s_h = 1 65 | s_w = 1 66 | group = 2 67 | conv2W = tf.Variable(net_data["conv2"][0]) 68 | conv2b = tf.Variable(net_data["conv2"][1]) 69 | conv2_in = conv(maxpool1, conv2W, conv2b, k_h, k_w, c_o, s_h, s_w, padding="SAME", group=group) 70 | conv2 = tf.nn.relu(conv2_in) 71 | 72 | # lrn2 73 | # lrn(2, 2e-05, 0.75, name='norm2') 74 | radius = 2 75 | alpha = 2e-05 76 | beta = 0.75 77 | bias = 1.0 78 | lrn2 = tf.nn.local_response_normalization(conv2, depth_radius=radius, alpha=alpha, beta=beta, bias=bias) 79 | 80 | # maxpool2 81 | # max_pool(3, 3, 2, 2, padding='VALID', name='pool2') 82 | k_h = 3 83 | k_w = 3 84 | s_h = 2 85 | s_w = 2 86 | padding = 'VALID' 87 | maxpool2 = tf.nn.max_pool(lrn2, ksize=[1, k_h, k_w, 1], strides=[1, s_h, s_w, 1], padding=padding) 88 | 89 | # conv3 90 | # conv(3, 3, 384, 1, 1, name='conv3') 91 | k_h = 3 92 | k_w = 3 93 | c_o = 384 94 | s_h = 1 95 | s_w = 1 96 | group = 1 97 | conv3W = tf.Variable(net_data["conv3"][0]) 98 | conv3b = tf.Variable(net_data["conv3"][1]) 99 | conv3_in = conv(maxpool2, conv3W, conv3b, k_h, k_w, c_o, s_h, s_w, padding="SAME", group=group) 100 | conv3 = tf.nn.relu(conv3_in) 101 | 102 | # conv4 103 | # conv(3, 3, 384, 1, 1, group=2, name='conv4') 104 | k_h = 3 105 | k_w = 3 106 | c_o = 384 107 | s_h = 1 108 | s_w = 1 109 | group = 2 110 | conv4W = tf.Variable(net_data["conv4"][0]) 111 | conv4b = tf.Variable(net_data["conv4"][1]) 112 | conv4_in = conv(conv3, conv4W, conv4b, k_h, k_w, c_o, s_h, s_w, padding="SAME", group=group) 113 | conv4 = tf.nn.relu(conv4_in) 114 | 115 | # conv5 116 | # conv(3, 3, 256, 1, 1, group=2, name='conv5') 117 | k_h = 3 118 | k_w = 3 119 | c_o = 256 120 | s_h = 1 121 | s_w = 1 122 | group = 2 123 | conv5W = tf.Variable(net_data["conv5"][0]) 124 | conv5b = tf.Variable(net_data["conv5"][1]) 125 | conv5_in = conv(conv4, conv5W, conv5b, k_h, k_w, c_o, s_h, s_w, padding="SAME", group=group) 126 | conv5 = tf.nn.relu(conv5_in) 127 | 128 | # maxpool5 129 | # max_pool(3, 3, 2, 2, padding='VALID', name='pool5') 130 | k_h = 3 131 | k_w = 3 132 | s_h = 2 133 | s_w = 2 134 | padding = 'VALID' 135 | maxpool5 = tf.nn.max_pool(conv5, ksize=[1, k_h, k_w, 1], strides=[1, s_h, s_w, 1], padding=padding) 136 | 137 | # fc6 138 | # fc(4096, name='fc6') 139 | fc6W = tf.Variable(net_data["fc6"][0]) 140 | fc6b = tf.Variable(net_data["fc6"][1]) 141 | fc6 = tf.nn.relu_layer(tf.reshape(maxpool5, [-1, int(np.prod(maxpool5.get_shape()[1:]))]), fc6W, fc6b) 142 | 143 | # fc7 144 | # fc(4096, name='fc7') 145 | fc7W = tf.Variable(net_data["fc7"][0]) 146 | fc7b = tf.Variable(net_data["fc7"][1]) 147 | fc7 = tf.nn.relu_layer(fc6, fc7W, fc7b) 148 | 149 | if feature_extract: 150 | return fc7 151 | 152 | # fc8 153 | # fc(1000, relu=False, name='fc8') 154 | fc8W = tf.Variable(net_data["fc8"][0]) 155 | fc8b = tf.Variable(net_data["fc8"][1]) 156 | 157 | logits = tf.nn.xw_plus_b(fc7, fc8W, fc8b) 158 | probabilities = tf.nn.softmax(logits) 159 | 160 | return probabilities 161 | -------------------------------------------------------------------------------- /caffe_classes.py: -------------------------------------------------------------------------------- 1 | class_names = '''tench, Tinca tinca 2 | goldfish, Carassius auratus 3 | great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias 4 | tiger shark, Galeocerdo cuvieri 5 | hammerhead, hammerhead shark 6 | electric ray, crampfish, numbfish, torpedo 7 | stingray 8 | cock 9 | hen 10 | ostrich, Struthio camelus 11 | brambling, Fringilla montifringilla 12 | goldfinch, Carduelis carduelis 13 | house finch, linnet, Carpodacus mexicanus 14 | junco, snowbird 15 | indigo bunting, indigo finch, indigo bird, Passerina cyanea 16 | robin, American robin, Turdus migratorius 17 | bulbul 18 | jay 19 | magpie 20 | chickadee 21 | water ouzel, dipper 22 | kite 23 | bald eagle, American eagle, Haliaeetus leucocephalus 24 | vulture 25 | great grey owl, great gray owl, Strix nebulosa 26 | European fire salamander, Salamandra salamandra 27 | common newt, Triturus vulgaris 28 | eft 29 | spotted salamander, Ambystoma maculatum 30 | axolotl, mud puppy, Ambystoma mexicanum 31 | bullfrog, Rana catesbeiana 32 | tree frog, tree-frog 33 | tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui 34 | loggerhead, loggerhead turtle, Caretta caretta 35 | leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea 36 | mud turtle 37 | terrapin 38 | box turtle, box tortoise 39 | banded gecko 40 | common iguana, iguana, Iguana iguana 41 | American chameleon, anole, Anolis carolinensis 42 | whiptail, whiptail lizard 43 | agama 44 | frilled lizard, Chlamydosaurus kingi 45 | alligator lizard 46 | Gila monster, Heloderma suspectum 47 | green lizard, Lacerta viridis 48 | African chameleon, Chamaeleo chamaeleon 49 | Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis 50 | African crocodile, Nile crocodile, Crocodylus niloticus 51 | American alligator, Alligator mississipiensis 52 | triceratops 53 | thunder snake, worm snake, Carphophis amoenus 54 | ringneck snake, ring-necked snake, ring snake 55 | hognose snake, puff adder, sand viper 56 | green snake, grass snake 57 | king snake, kingsnake 58 | garter snake, grass snake 59 | water snake 60 | vine snake 61 | night snake, Hypsiglena torquata 62 | boa constrictor, Constrictor constrictor 63 | rock python, rock snake, Python sebae 64 | Indian cobra, Naja naja 65 | green mamba 66 | sea snake 67 | horned viper, cerastes, sand viper, horned asp, Cerastes cornutus 68 | diamondback, diamondback rattlesnake, Crotalus adamanteus 69 | sidewinder, horned rattlesnake, Crotalus cerastes 70 | trilobite 71 | harvestman, daddy longlegs, Phalangium opilio 72 | scorpion 73 | black and gold garden spider, Argiope aurantia 74 | barn spider, Araneus cavaticus 75 | garden spider, Aranea diademata 76 | black widow, Latrodectus mactans 77 | tarantula 78 | wolf spider, hunting spider 79 | tick 80 | centipede 81 | black grouse 82 | ptarmigan 83 | ruffed grouse, partridge, Bonasa umbellus 84 | prairie chicken, prairie grouse, prairie fowl 85 | peacock 86 | quail 87 | partridge 88 | African grey, African gray, Psittacus erithacus 89 | macaw 90 | sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita 91 | lorikeet 92 | coucal 93 | bee eater 94 | hornbill 95 | hummingbird 96 | jacamar 97 | toucan 98 | drake 99 | red-breasted merganser, Mergus serrator 100 | goose 101 | black swan, Cygnus atratus 102 | tusker 103 | echidna, spiny anteater, anteater 104 | platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus 105 | wallaby, brush kangaroo 106 | koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus 107 | wombat 108 | jellyfish 109 | sea anemone, anemone 110 | brain coral 111 | flatworm, platyhelminth 112 | nematode, nematode worm, roundworm 113 | conch 114 | snail 115 | slug 116 | sea slug, nudibranch 117 | chiton, coat-of-mail shell, sea cradle, polyplacophore 118 | chambered nautilus, pearly nautilus, nautilus 119 | Dungeness crab, Cancer magister 120 | rock crab, Cancer irroratus 121 | fiddler crab 122 | king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica 123 | American lobster, Northern lobster, Maine lobster, Homarus americanus 124 | spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish 125 | crayfish, crawfish, crawdad, crawdaddy 126 | hermit crab 127 | isopod 128 | white stork, Ciconia ciconia 129 | black stork, Ciconia nigra 130 | spoonbill 131 | flamingo 132 | little blue heron, Egretta caerulea 133 | American egret, great white heron, Egretta albus 134 | bittern 135 | crane 136 | limpkin, Aramus pictus 137 | European gallinule, Porphyrio porphyrio 138 | American coot, marsh hen, mud hen, water hen, Fulica americana 139 | bustard 140 | ruddy turnstone, Arenaria interpres 141 | red-backed sandpiper, dunlin, Erolia alpina 142 | redshank, Tringa totanus 143 | dowitcher 144 | oystercatcher, oyster catcher 145 | pelican 146 | king penguin, Aptenodytes patagonica 147 | albatross, mollymawk 148 | grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus 149 | killer whale, killer, orca, grampus, sea wolf, Orcinus orca 150 | dugong, Dugong dugon 151 | sea lion 152 | Chihuahua 153 | Japanese spaniel 154 | Maltese dog, Maltese terrier, Maltese 155 | Pekinese, Pekingese, Peke 156 | Shih-Tzu 157 | Blenheim spaniel 158 | papillon 159 | toy terrier 160 | Rhodesian ridgeback 161 | Afghan hound, Afghan 162 | basset, basset hound 163 | beagle 164 | bloodhound, sleuthhound 165 | bluetick 166 | black-and-tan coonhound 167 | Walker hound, Walker foxhound 168 | English foxhound 169 | redbone 170 | borzoi, Russian wolfhound 171 | Irish wolfhound 172 | Italian greyhound 173 | whippet 174 | Ibizan hound, Ibizan Podenco 175 | Norwegian elkhound, elkhound 176 | otterhound, otter hound 177 | Saluki, gazelle hound 178 | Scottish deerhound, deerhound 179 | Weimaraner 180 | Staffordshire bullterrier, Staffordshire bull terrier 181 | American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier 182 | Bedlington terrier 183 | Border terrier 184 | Kerry blue terrier 185 | Irish terrier 186 | Norfolk terrier 187 | Norwich terrier 188 | Yorkshire terrier 189 | wire-haired fox terrier 190 | Lakeland terrier 191 | Sealyham terrier, Sealyham 192 | Airedale, Airedale terrier 193 | cairn, cairn terrier 194 | Australian terrier 195 | Dandie Dinmont, Dandie Dinmont terrier 196 | Boston bull, Boston terrier 197 | miniature schnauzer 198 | giant schnauzer 199 | standard schnauzer 200 | Scotch terrier, Scottish terrier, Scottie 201 | Tibetan terrier, chrysanthemum dog 202 | silky terrier, Sydney silky 203 | soft-coated wheaten terrier 204 | West Highland white terrier 205 | Lhasa, Lhasa apso 206 | flat-coated retriever 207 | curly-coated retriever 208 | golden retriever 209 | Labrador retriever 210 | Chesapeake Bay retriever 211 | German short-haired pointer 212 | vizsla, Hungarian pointer 213 | English setter 214 | Irish setter, red setter 215 | Gordon setter 216 | Brittany spaniel 217 | clumber, clumber spaniel 218 | English springer, English springer spaniel 219 | Welsh springer spaniel 220 | cocker spaniel, English cocker spaniel, cocker 221 | Sussex spaniel 222 | Irish water spaniel 223 | kuvasz 224 | schipperke 225 | groenendael 226 | malinois 227 | briard 228 | kelpie 229 | komondor 230 | Old English sheepdog, bobtail 231 | Shetland sheepdog, Shetland sheep dog, Shetland 232 | collie 233 | Border collie 234 | Bouvier des Flandres, Bouviers des Flandres 235 | Rottweiler 236 | German shepherd, German shepherd dog, German police dog, alsatian 237 | Doberman, Doberman pinscher 238 | miniature pinscher 239 | Greater Swiss Mountain dog 240 | Bernese mountain dog 241 | Appenzeller 242 | EntleBucher 243 | boxer 244 | bull mastiff 245 | Tibetan mastiff 246 | French bulldog 247 | Great Dane 248 | Saint Bernard, St Bernard 249 | Eskimo dog, husky 250 | malamute, malemute, Alaskan malamute 251 | Siberian husky 252 | dalmatian, coach dog, carriage dog 253 | affenpinscher, monkey pinscher, monkey dog 254 | basenji 255 | pug, pug-dog 256 | Leonberg 257 | Newfoundland, Newfoundland dog 258 | Great Pyrenees 259 | Samoyed, Samoyede 260 | Pomeranian 261 | chow, chow chow 262 | keeshond 263 | Brabancon griffon 264 | Pembroke, Pembroke Welsh corgi 265 | Cardigan, Cardigan Welsh corgi 266 | toy poodle 267 | miniature poodle 268 | standard poodle 269 | Mexican hairless 270 | timber wolf, grey wolf, gray wolf, Canis lupus 271 | white wolf, Arctic wolf, Canis lupus tundrarum 272 | red wolf, maned wolf, Canis rufus, Canis niger 273 | coyote, prairie wolf, brush wolf, Canis latrans 274 | dingo, warrigal, warragal, Canis dingo 275 | dhole, Cuon alpinus 276 | African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus 277 | hyena, hyaena 278 | red fox, Vulpes vulpes 279 | kit fox, Vulpes macrotis 280 | Arctic fox, white fox, Alopex lagopus 281 | grey fox, gray fox, Urocyon cinereoargenteus 282 | tabby, tabby cat 283 | tiger cat 284 | Persian cat 285 | Siamese cat, Siamese 286 | Egyptian cat 287 | cougar, puma, catamount, mountain lion, painter, panther, Felis concolor 288 | lynx, catamount 289 | leopard, Panthera pardus 290 | snow leopard, ounce, Panthera uncia 291 | jaguar, panther, Panthera onca, Felis onca 292 | lion, king of beasts, Panthera leo 293 | tiger, Panthera tigris 294 | cheetah, chetah, Acinonyx jubatus 295 | brown bear, bruin, Ursus arctos 296 | American black bear, black bear, Ursus americanus, Euarctos americanus 297 | ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus 298 | sloth bear, Melursus ursinus, Ursus ursinus 299 | mongoose 300 | meerkat, mierkat 301 | tiger beetle 302 | ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle 303 | ground beetle, carabid beetle 304 | long-horned beetle, longicorn, longicorn beetle 305 | leaf beetle, chrysomelid 306 | dung beetle 307 | rhinoceros beetle 308 | weevil 309 | fly 310 | bee 311 | ant, emmet, pismire 312 | grasshopper, hopper 313 | cricket 314 | walking stick, walkingstick, stick insect 315 | cockroach, roach 316 | mantis, mantid 317 | cicada, cicala 318 | leafhopper 319 | lacewing, lacewing fly 320 | dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk 321 | damselfly 322 | admiral 323 | ringlet, ringlet butterfly 324 | monarch, monarch butterfly, milkweed butterfly, Danaus plexippus 325 | cabbage butterfly 326 | sulphur butterfly, sulfur butterfly 327 | lycaenid, lycaenid butterfly 328 | starfish, sea star 329 | sea urchin 330 | sea cucumber, holothurian 331 | wood rabbit, cottontail, cottontail rabbit 332 | hare 333 | Angora, Angora rabbit 334 | hamster 335 | porcupine, hedgehog 336 | fox squirrel, eastern fox squirrel, Sciurus niger 337 | marmot 338 | beaver 339 | guinea pig, Cavia cobaya 340 | sorrel 341 | zebra 342 | hog, pig, grunter, squealer, Sus scrofa 343 | wild boar, boar, Sus scrofa 344 | warthog 345 | hippopotamus, hippo, river horse, Hippopotamus amphibius 346 | ox 347 | water buffalo, water ox, Asiatic buffalo, Bubalus bubalis 348 | bison 349 | ram, tup 350 | bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis 351 | ibex, Capra ibex 352 | hartebeest 353 | impala, Aepyceros melampus 354 | gazelle 355 | Arabian camel, dromedary, Camelus dromedarius 356 | llama 357 | weasel 358 | mink 359 | polecat, fitch, foulmart, foumart, Mustela putorius 360 | black-footed ferret, ferret, Mustela nigripes 361 | otter 362 | skunk, polecat, wood pussy 363 | badger 364 | armadillo 365 | three-toed sloth, ai, Bradypus tridactylus 366 | orangutan, orang, orangutang, Pongo pygmaeus 367 | gorilla, Gorilla gorilla 368 | chimpanzee, chimp, Pan troglodytes 369 | gibbon, Hylobates lar 370 | siamang, Hylobates syndactylus, Symphalangus syndactylus 371 | guenon, guenon monkey 372 | patas, hussar monkey, Erythrocebus patas 373 | baboon 374 | macaque 375 | langur 376 | colobus, colobus monkey 377 | proboscis monkey, Nasalis larvatus 378 | marmoset 379 | capuchin, ringtail, Cebus capucinus 380 | howler monkey, howler 381 | titi, titi monkey 382 | spider monkey, Ateles geoffroyi 383 | squirrel monkey, Saimiri sciureus 384 | Madagascar cat, ring-tailed lemur, Lemur catta 385 | indri, indris, Indri indri, Indri brevicaudatus 386 | Indian elephant, Elephas maximus 387 | African elephant, Loxodonta africana 388 | lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens 389 | giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca 390 | barracouta, snoek 391 | eel 392 | coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch 393 | rock beauty, Holocanthus tricolor 394 | anemone fish 395 | sturgeon 396 | gar, garfish, garpike, billfish, Lepisosteus osseus 397 | lionfish 398 | puffer, pufferfish, blowfish, globefish 399 | abacus 400 | abaya 401 | academic gown, academic robe, judge's robe 402 | accordion, piano accordion, squeeze box 403 | acoustic guitar 404 | aircraft carrier, carrier, flattop, attack aircraft carrier 405 | airliner 406 | airship, dirigible 407 | altar 408 | ambulance 409 | amphibian, amphibious vehicle 410 | analog clock 411 | apiary, bee house 412 | apron 413 | ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin 414 | assault rifle, assault gun 415 | backpack, back pack, knapsack, packsack, rucksack, haversack 416 | bakery, bakeshop, bakehouse 417 | balance beam, beam 418 | balloon 419 | ballpoint, ballpoint pen, ballpen, Biro 420 | Band Aid 421 | banjo 422 | bannister, banister, balustrade, balusters, handrail 423 | barbell 424 | barber chair 425 | barbershop 426 | barn 427 | barometer 428 | barrel, cask 429 | barrow, garden cart, lawn cart, wheelbarrow 430 | baseball 431 | basketball 432 | bassinet 433 | bassoon 434 | bathing cap, swimming cap 435 | bath towel 436 | bathtub, bathing tub, bath, tub 437 | beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon 438 | beacon, lighthouse, beacon light, pharos 439 | beaker 440 | bearskin, busby, shako 441 | beer bottle 442 | beer glass 443 | bell cote, bell cot 444 | bib 445 | bicycle-built-for-two, tandem bicycle, tandem 446 | bikini, two-piece 447 | binder, ring-binder 448 | binoculars, field glasses, opera glasses 449 | birdhouse 450 | boathouse 451 | bobsled, bobsleigh, bob 452 | bolo tie, bolo, bola tie, bola 453 | bonnet, poke bonnet 454 | bookcase 455 | bookshop, bookstore, bookstall 456 | bottlecap 457 | bow 458 | bow tie, bow-tie, bowtie 459 | brass, memorial tablet, plaque 460 | brassiere, bra, bandeau 461 | breakwater, groin, groyne, mole, bulwark, seawall, jetty 462 | breastplate, aegis, egis 463 | broom 464 | bucket, pail 465 | buckle 466 | bulletproof vest 467 | bullet train, bullet 468 | butcher shop, meat market 469 | cab, hack, taxi, taxicab 470 | caldron, cauldron 471 | candle, taper, wax light 472 | cannon 473 | canoe 474 | can opener, tin opener 475 | cardigan 476 | car mirror 477 | carousel, carrousel, merry-go-round, roundabout, whirligig 478 | carpenter's kit, tool kit 479 | carton 480 | car wheel 481 | cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM 482 | cassette 483 | cassette player 484 | castle 485 | catamaran 486 | CD player 487 | cello, violoncello 488 | cellular telephone, cellular phone, cellphone, cell, mobile phone 489 | chain 490 | chainlink fence 491 | chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour 492 | chain saw, chainsaw 493 | chest 494 | chiffonier, commode 495 | chime, bell, gong 496 | china cabinet, china closet 497 | Christmas stocking 498 | church, church building 499 | cinema, movie theater, movie theatre, movie house, picture palace 500 | cleaver, meat cleaver, chopper 501 | cliff dwelling 502 | cloak 503 | clog, geta, patten, sabot 504 | cocktail shaker 505 | coffee mug 506 | coffeepot 507 | coil, spiral, volute, whorl, helix 508 | combination lock 509 | computer keyboard, keypad 510 | confectionery, confectionary, candy store 511 | container ship, containership, container vessel 512 | convertible 513 | corkscrew, bottle screw 514 | cornet, horn, trumpet, trump 515 | cowboy boot 516 | cowboy hat, ten-gallon hat 517 | cradle 518 | crane 519 | crash helmet 520 | crate 521 | crib, cot 522 | Crock Pot 523 | croquet ball 524 | crutch 525 | cuirass 526 | dam, dike, dyke 527 | desk 528 | desktop computer 529 | dial telephone, dial phone 530 | diaper, nappy, napkin 531 | digital clock 532 | digital watch 533 | dining table, board 534 | dishrag, dishcloth 535 | dishwasher, dish washer, dishwashing machine 536 | disk brake, disc brake 537 | dock, dockage, docking facility 538 | dogsled, dog sled, dog sleigh 539 | dome 540 | doormat, welcome mat 541 | drilling platform, offshore rig 542 | drum, membranophone, tympan 543 | drumstick 544 | dumbbell 545 | Dutch oven 546 | electric fan, blower 547 | electric guitar 548 | electric locomotive 549 | entertainment center 550 | envelope 551 | espresso maker 552 | face powder 553 | feather boa, boa 554 | file, file cabinet, filing cabinet 555 | fireboat 556 | fire engine, fire truck 557 | fire screen, fireguard 558 | flagpole, flagstaff 559 | flute, transverse flute 560 | folding chair 561 | football helmet 562 | forklift 563 | fountain 564 | fountain pen 565 | four-poster 566 | freight car 567 | French horn, horn 568 | frying pan, frypan, skillet 569 | fur coat 570 | garbage truck, dustcart 571 | gasmask, respirator, gas helmet 572 | gas pump, gasoline pump, petrol pump, island dispenser 573 | goblet 574 | go-kart 575 | golf ball 576 | golfcart, golf cart 577 | gondola 578 | gong, tam-tam 579 | gown 580 | grand piano, grand 581 | greenhouse, nursery, glasshouse 582 | grille, radiator grille 583 | grocery store, grocery, food market, market 584 | guillotine 585 | hair slide 586 | hair spray 587 | half track 588 | hammer 589 | hamper 590 | hand blower, blow dryer, blow drier, hair dryer, hair drier 591 | hand-held computer, hand-held microcomputer 592 | handkerchief, hankie, hanky, hankey 593 | hard disc, hard disk, fixed disk 594 | harmonica, mouth organ, harp, mouth harp 595 | harp 596 | harvester, reaper 597 | hatchet 598 | holster 599 | home theater, home theatre 600 | honeycomb 601 | hook, claw 602 | hoopskirt, crinoline 603 | horizontal bar, high bar 604 | horse cart, horse-cart 605 | hourglass 606 | iPod 607 | iron, smoothing iron 608 | jack-o'-lantern 609 | jean, blue jean, denim 610 | jeep, landrover 611 | jersey, T-shirt, tee shirt 612 | jigsaw puzzle 613 | jinrikisha, ricksha, rickshaw 614 | joystick 615 | kimono 616 | knee pad 617 | knot 618 | lab coat, laboratory coat 619 | ladle 620 | lampshade, lamp shade 621 | laptop, laptop computer 622 | lawn mower, mower 623 | lens cap, lens cover 624 | letter opener, paper knife, paperknife 625 | library 626 | lifeboat 627 | lighter, light, igniter, ignitor 628 | limousine, limo 629 | liner, ocean liner 630 | lipstick, lip rouge 631 | Loafer 632 | lotion 633 | loudspeaker, speaker, speaker unit, loudspeaker system, speaker system 634 | loupe, jeweler's loupe 635 | lumbermill, sawmill 636 | magnetic compass 637 | mailbag, postbag 638 | mailbox, letter box 639 | maillot 640 | maillot, tank suit 641 | manhole cover 642 | maraca 643 | marimba, xylophone 644 | mask 645 | matchstick 646 | maypole 647 | maze, labyrinth 648 | measuring cup 649 | medicine chest, medicine cabinet 650 | megalith, megalithic structure 651 | microphone, mike 652 | microwave, microwave oven 653 | military uniform 654 | milk can 655 | minibus 656 | miniskirt, mini 657 | minivan 658 | missile 659 | mitten 660 | mixing bowl 661 | mobile home, manufactured home 662 | Model T 663 | modem 664 | monastery 665 | monitor 666 | moped 667 | mortar 668 | mortarboard 669 | mosque 670 | mosquito net 671 | motor scooter, scooter 672 | mountain bike, all-terrain bike, off-roader 673 | mountain tent 674 | mouse, computer mouse 675 | mousetrap 676 | moving van 677 | muzzle 678 | nail 679 | neck brace 680 | necklace 681 | nipple 682 | notebook, notebook computer 683 | obelisk 684 | oboe, hautboy, hautbois 685 | ocarina, sweet potato 686 | odometer, hodometer, mileometer, milometer 687 | oil filter 688 | organ, pipe organ 689 | oscilloscope, scope, cathode-ray oscilloscope, CRO 690 | overskirt 691 | oxcart 692 | oxygen mask 693 | packet 694 | paddle, boat paddle 695 | paddlewheel, paddle wheel 696 | padlock 697 | paintbrush 698 | pajama, pyjama, pj's, jammies 699 | palace 700 | panpipe, pandean pipe, syrinx 701 | paper towel 702 | parachute, chute 703 | parallel bars, bars 704 | park bench 705 | parking meter 706 | passenger car, coach, carriage 707 | patio, terrace 708 | pay-phone, pay-station 709 | pedestal, plinth, footstall 710 | pencil box, pencil case 711 | pencil sharpener 712 | perfume, essence 713 | Petri dish 714 | photocopier 715 | pick, plectrum, plectron 716 | pickelhaube 717 | picket fence, paling 718 | pickup, pickup truck 719 | pier 720 | piggy bank, penny bank 721 | pill bottle 722 | pillow 723 | ping-pong ball 724 | pinwheel 725 | pirate, pirate ship 726 | pitcher, ewer 727 | plane, carpenter's plane, woodworking plane 728 | planetarium 729 | plastic bag 730 | plate rack 731 | plow, plough 732 | plunger, plumber's helper 733 | Polaroid camera, Polaroid Land camera 734 | pole 735 | police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria 736 | poncho 737 | pool table, billiard table, snooker table 738 | pop bottle, soda bottle 739 | pot, flowerpot 740 | potter's wheel 741 | power drill 742 | prayer rug, prayer mat 743 | printer 744 | prison, prison house 745 | projectile, missile 746 | projector 747 | puck, hockey puck 748 | punching bag, punch bag, punching ball, punchball 749 | purse 750 | quill, quill pen 751 | quilt, comforter, comfort, puff 752 | racer, race car, racing car 753 | racket, racquet 754 | radiator 755 | radio, wireless 756 | radio telescope, radio reflector 757 | rain barrel 758 | recreational vehicle, RV, R.V. 759 | reel 760 | reflex camera 761 | refrigerator, icebox 762 | remote control, remote 763 | restaurant, eating house, eating place, eatery 764 | revolver, six-gun, six-shooter 765 | rifle 766 | rocking chair, rocker 767 | rotisserie 768 | rubber eraser, rubber, pencil eraser 769 | rugby ball 770 | rule, ruler 771 | running shoe 772 | safe 773 | safety pin 774 | saltshaker, salt shaker 775 | sandal 776 | sarong 777 | sax, saxophone 778 | scabbard 779 | scale, weighing machine 780 | school bus 781 | schooner 782 | scoreboard 783 | screen, CRT screen 784 | screw 785 | screwdriver 786 | seat belt, seatbelt 787 | sewing machine 788 | shield, buckler 789 | shoe shop, shoe-shop, shoe store 790 | shoji 791 | shopping basket 792 | shopping cart 793 | shovel 794 | shower cap 795 | shower curtain 796 | ski 797 | ski mask 798 | sleeping bag 799 | slide rule, slipstick 800 | sliding door 801 | slot, one-armed bandit 802 | snorkel 803 | snowmobile 804 | snowplow, snowplough 805 | soap dispenser 806 | soccer ball 807 | sock 808 | solar dish, solar collector, solar furnace 809 | sombrero 810 | soup bowl 811 | space bar 812 | space heater 813 | space shuttle 814 | spatula 815 | speedboat 816 | spider web, spider's web 817 | spindle 818 | sports car, sport car 819 | spotlight, spot 820 | stage 821 | steam locomotive 822 | steel arch bridge 823 | steel drum 824 | stethoscope 825 | stole 826 | stone wall 827 | stopwatch, stop watch 828 | stove 829 | strainer 830 | streetcar, tram, tramcar, trolley, trolley car 831 | stretcher 832 | studio couch, day bed 833 | stupa, tope 834 | submarine, pigboat, sub, U-boat 835 | suit, suit of clothes 836 | sundial 837 | sunglass 838 | sunglasses, dark glasses, shades 839 | sunscreen, sunblock, sun blocker 840 | suspension bridge 841 | swab, swob, mop 842 | sweatshirt 843 | swimming trunks, bathing trunks 844 | swing 845 | switch, electric switch, electrical switch 846 | syringe 847 | table lamp 848 | tank, army tank, armored combat vehicle, armoured combat vehicle 849 | tape player 850 | teapot 851 | teddy, teddy bear 852 | television, television system 853 | tennis ball 854 | thatch, thatched roof 855 | theater curtain, theatre curtain 856 | thimble 857 | thresher, thrasher, threshing machine 858 | throne 859 | tile roof 860 | toaster 861 | tobacco shop, tobacconist shop, tobacconist 862 | toilet seat 863 | torch 864 | totem pole 865 | tow truck, tow car, wrecker 866 | toyshop 867 | tractor 868 | trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi 869 | tray 870 | trench coat 871 | tricycle, trike, velocipede 872 | trimaran 873 | tripod 874 | triumphal arch 875 | trolleybus, trolley coach, trackless trolley 876 | trombone 877 | tub, vat 878 | turnstile 879 | typewriter keyboard 880 | umbrella 881 | unicycle, monocycle 882 | upright, upright piano 883 | vacuum, vacuum cleaner 884 | vase 885 | vault 886 | velvet 887 | vending machine 888 | vestment 889 | viaduct 890 | violin, fiddle 891 | volleyball 892 | waffle iron 893 | wall clock 894 | wallet, billfold, notecase, pocketbook 895 | wardrobe, closet, press 896 | warplane, military plane 897 | washbasin, handbasin, washbowl, lavabo, wash-hand basin 898 | washer, automatic washer, washing machine 899 | water bottle 900 | water jug 901 | water tower 902 | whiskey jug 903 | whistle 904 | wig 905 | window screen 906 | window shade 907 | Windsor tie 908 | wine bottle 909 | wing 910 | wok 911 | wooden spoon 912 | wool, woolen, woollen 913 | worm fence, snake fence, snake-rail fence, Virginia fence 914 | wreck 915 | yawl 916 | yurt 917 | web site, website, internet site, site 918 | comic book 919 | crossword puzzle, crossword 920 | street sign 921 | traffic light, traffic signal, stoplight 922 | book jacket, dust cover, dust jacket, dust wrapper 923 | menu 924 | plate 925 | guacamole 926 | consomme 927 | hot pot, hotpot 928 | trifle 929 | ice cream, icecream 930 | ice lolly, lolly, lollipop, popsicle 931 | French loaf 932 | bagel, beigel 933 | pretzel 934 | cheeseburger 935 | hotdog, hot dog, red hot 936 | mashed potato 937 | head cabbage 938 | broccoli 939 | cauliflower 940 | zucchini, courgette 941 | spaghetti squash 942 | acorn squash 943 | butternut squash 944 | cucumber, cuke 945 | artichoke, globe artichoke 946 | bell pepper 947 | cardoon 948 | mushroom 949 | Granny Smith 950 | strawberry 951 | orange 952 | lemon 953 | fig 954 | pineapple, ananas 955 | banana 956 | jackfruit, jak, jack 957 | custard apple 958 | pomegranate 959 | hay 960 | carbonara 961 | chocolate sauce, chocolate syrup 962 | dough 963 | meat loaf, meatloaf 964 | pizza, pizza pie 965 | potpie 966 | burrito 967 | red wine 968 | espresso 969 | cup 970 | eggnog 971 | alp 972 | bubble 973 | cliff, drop, drop-off 974 | coral reef 975 | geyser 976 | lakeside, lakeshore 977 | promontory, headland, head, foreland 978 | sandbar, sand bar 979 | seashore, coast, seacoast, sea-coast 980 | valley, vale 981 | volcano 982 | ballplayer, baseball player 983 | groom, bridegroom 984 | scuba diver 985 | rapeseed 986 | daisy 987 | yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum 988 | corn 989 | acorn 990 | hip, rose hip, rosehip 991 | buckeye, horse chestnut, conker 992 | coral fungus 993 | agaric 994 | gyromitra 995 | stinkhorn, carrion fungus 996 | earthstar 997 | hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa 998 | bolete 999 | ear, spike, capitulum 1000 | toilet tissue, toilet paper, bathroom tissue'''.split("\n") --------------------------------------------------------------------------------