This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config = 'yolov2.cfg' | |
model = 'yolov2.weights' | |
Net_YOLO = cv.dnn.readNetFromDarknet(config, model) | |
Net_YOLO.setInput(cv.dnn.blobFromImage(img, 1.0/255.0, (416, 416), swapRB = True, crop = False)) | |
Net_YOLO_pred = Net_YOLO.forward() | |
print(">>> YOLOv2 prediction shape = ", Net_YOLO_pred.shape) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tensorflow (CPU) | PlaidML (Intel GPU) | PlaidML (AMD GPU) | ||
---|---|---|---|---|
Training Time | 16969 sec | 4314 sec | 1841 sec | |
Evaluation Time | 18 sec | 21 sec | 13 sec | |
Evaluation Accuacy | 67% | 69% | 68% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Experimental Config Devices: | |
opencl_amd_hainan.0 : Advanced Micro Devices, Inc. Hainan (OpenCL) | |
opencl_cpu.0 : Intel(R) Corporation CPU (OpenCL) | |
opencl_intel_intel(r)_hd_graphics_5500.0 : Intel(R) Corporation Intel(R) HD Graphics 5500 (OpenCL) | |
Using experimental devices can cause poor performance, crashes, and other nastiness. | |
Enable experimental device support? (y,n)[n]:y | |
Multiple devices detected (You can override by setting PLAIDML_DEVICE_IDS). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tensorflow (CPU) | PlaidML (Intel GPU) | PlaidML (AMD GPU) | ||
---|---|---|---|---|
Training Time | 16969 sec | 4314 sec | 1814 sec | |
Evaluation Time | 18 sec | 21 sec | 13 sec | |
Evaluation Accuacy | 0.67% | 0.69% | 0.68% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> CNN Model Training ... | |
Train on 2275 samples, validate on 253 samples | |
Epoch 1/13 | |
2275/2275 [==============================] - 2990s 1s/step - loss: 0.3658 - acc: 0.8958 - val_loss: 1.3321 - val_acc: 0.7628 | |
Epoch 2/13 | |
2275/2275 [==============================] - 3011s 1s/step - loss: 0.1767 - acc: 0.9499 - val_loss: 2.3750 - val_acc: 0.6443 | |
Epoch 3/13 | |
2275/2275 [==============================] - 2926s 1s/step - loss: 0.1461 - acc: 0.9582 - val_loss: 0.8264 - val_acc: 0.7747 | |
Epoch 4/13 | |
2275/2275 [==============================] - 2779s 1s/step - loss: 0.0661 - acc: 0.9811 - val_loss: 0.1774 - val_acc: 0.9447 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object Detection Model | SSD | YOLOv2 | |
---|---|---|---|
Object Classification Model | MobileNet | Darknet-19 | |
Pre-trained Dataset | COCO | COCO | |
Deep Learning Software Platform | Tensorflow | Darknet | |
OpenCV ReadNet Function Call | readNetFromTensorflow | readNetFromDarknet | |
Config File | frozen_inference_graph.pb | yolov2.cfg | |
Weight File | ssd_mobilenet_v1_coco_2017_11_17.pbtxt | yolov2.weights | |
OpenCV Forward Function Return | (1, 1, 100, 7) | (845, 85) | |
Representation of Bounding Box | (left, top, right, bottom) | (x_center, y_center, width, height) | |
Representation of Class Name | 90 | 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cat/Dog Audio | British Birdsong | Music Genre | Urban Sound | |||
---|---|---|---|---|---|---|
Source | Kaggle | Kaggle | Marsyas | UrbanSoundDataset | ||
Total Size | 49 MB | 633 MB | 1 GB | 6 GB | ||
Number of Audio Files (total) | 277 | 264 | 1000 | 8732 | ||
Number of Audio Files (training) | - | - | - | 5435* | ||
Number of Audio files (testing) | - | - | - | 3297* | ||
Number of Classes | 2 | 88 | 10 | 10 | ||
Audio Files per Class | cat (164) | 3 | blues (100) | air_conditioner (1000) | ||
dog (113) | classical (100) | children_playing (1000) | ||||
country (100) | dog_bark (1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MNIST | CIFAR | Fashion | Dog/Cat | Shape | Fruit | Distracted Driver | Hand Gesture | |||
---|---|---|---|---|---|---|---|---|---|---|
Source | Keras | Keras | Keras | Home-Made | ? | ? | ? | ? | ||
Total Size | ? | ? | ? | ? | ? | ? | ? | ? | ||
Number of Image Files (total) | 70000 | 60000 | 70000 | ? | ? | ? | ? | ? | ||
Number of Image Files (training) | 60000 | 50000 | 60000 | ? | ? | ? | ? | ? | ||
Number of Image files (testing) | 10000 | 10000 | 10000 | ? | ? | ? | ? | ? | ||
Number of Classes | 10 | 10/100 | 10 | 2 | ? | ? | ? | ? | ||
Image Files per Class | 7000 | 6000/600 | 7000 | >1000 | ? | ? | ? | ? | ||
Size per Image File (max/min) | 28x28 | 32x32 | 28x28 | ? | ? | ? | ? | ? | ||
Format of Image File | numpy | numpy | numpy | ? | ? | ? | ? | ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cat/Dog Audio | British Birdsong | Heartbeat | Music Genre | Urban Sound | |||
---|---|---|---|---|---|---|---|
Source | Kaggle | Kaggle | Kaggle | Marsyas | UrbanSoundDataset | ||
Total Size | 49 MB | 633 MB | 111 MB | 1 GB | 6 GB | ||
Number of Audio Files (total) | 277 | 264 | ? | 1000 | 8732 | ||
Number of Audio Files (training) | - | - | ? | - | - | ||
Number of Audio files (testing) | - | - | ? | - | - | ||
Number of Classes | 2 | 88 | ? | 10 | 10 | ||
Audio Files per Class | cat (164) | 3 | ? | blues (100) | air_conditioner (1000) | ||
dog (113) | classical (100) | children_playing (1000) | |||||
country (100) | dog_bark (1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import Numpy, Scipy, and Matplotlib | |
import numpy as np | |
import scipy as sp | |
import matplotlib.pyplot as plt | |
# import Keras's functional api | |
from keras.models import Model | |
# get the weights from the last layer | |
gap_weights = model.layers[-1].get_weights()[0] |