End-term portfolio
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Advanced Artificial Intelligence Assignment
Graduate project level 2
Abstract
Artificial Intelligence (AI) is a crucial technical technology that is commonly used in today's
society. Deep Learning, in particular, has a variety of uses due to its ability to learn robust
representations from images. A Convolutional Neural Network (CNN) is a Deep Learning
algorithm which commands the input image, assigns significance to numerous aspects/objects in
the image, and can distinguish between them. For image classification, CNN is the most popular
Deep Learning architecture. To get better results, we used various automated processing tasks for
fruit and vegetable images. In comparison to other classification deep learning algorithms, the
amount of pre-processing needed by a CNN model is much lower. Furthermore, the learning
capabilities of Deep Learning architectures can be used to improve sound classification in order
to solve efficiency problems. CNN is used in this project, and layers are created to classify the
sound waves into their various categories.
Introduction
We humans enjoy analyzing items, and everything you can think of can be classified into a
classification or class. It is an everyday issue in business; analysis of parts, installations,
gatherings, and products are necessary for the daily routine. This is the reason why people have
devised procedures such as Machine Learning (ML), Neural Networks (NN), and Deep Learning
(DL), among other calculations, to automate the arrangement period. Deep learning will be one
of them that we will explore. Deep learning is an artificial intelligence (AI) function that
simulates how the human brain processes data and creates patterns to make decisions. The
classification of photographs of fruits and vegetables with the naked eye is very difficult. As a
result, we're using pyTorch to process image datasets with Deep Learning. We're developing a
CNN model for image detection and categorization using these datasets. A custom CNN is
introduced and then compared to a ResNet CNN for the purposes of this study. The other is
sound classification, in which we classify specific sounds and measure their accuracy using
datasets given by ultrasound8k.
[1] Fruits, Vegetables and Deep Learning Processing Image Datasets with Convolutional
Neural Networks using PyTorch
Description: Convolutional Neural Networks or Deep Learning architectures were developed
form the inspiration of the human brain and how it process information. CNN are a type of
Neural Network that provides good results in areas such as image processing, image recognition
and image classification. This is the reason why, based on the title of this piece, a CNN model is
required.
Convolutional Neural Networks are a branch of Deep Learning. The human brain and how it
processes knowledge inspired the creation of Convolutional Neural Networks. CNNs are a type
of Neural Network that performs well in image processing, image recognition, and image
classification. This is why, as the title of this article suggests, a CNN model is needed.
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
CNNs are a form of artificial neural network that filters data using convolutional layers for
learning purposes. To create a transformed image, input data (feature map) is combined with a
convolution kernel (filter).
The input layer, hidden layers (which can range from 1 to the number required by the
application), and output layer are the three main components of a CNN. A CNN differs from a
normal Neural Network in that its layers are structured in three dimensions (width, height, and
depth). Convolution, pooling, normalization, and completely linked layers make up the hidden
layers.
To put it another way, a CNN is a Deep Learning algorithm that can take images as input, inspect
them in various ways for patterns or artifacts, and then output the ability to distinguish one from
another.
Steps:
The main aim of this question is to use classify fruits, vegetables using CNN and using
PyTorch library.
The "Fruits 360 Dataset" will be used because the aim of this Question is to analyze
image classification. This dataset, which is available on Kaggle, includes images of fruits
and vegetables with the following key characteristics:
Total number of images: 90483.
Training set size: 67692 images (one fruit or vegetable per image).
Test set size: 22688 images (one fruit or vegetable per image).
Multi-fruits set size: 103 images (more than one fruit (or fruit class) per image)
Number of classes: 131 (fruits and vegetables).
Image size: 100x100 pixels.
DataSet Size:700MB
To add this dataset in Kaggle we have to click on toggle sidebar in which you will find
add data option we have to click it and search for dataset fruits360 and add it.
Since we are doing our project has large dataset we have to use GPU processor to execute
our models fastly. It is available in Kaggle for 40 hours to new users. We also have make
sure the internet is on in Kaggle which is under settings.
Since the data set is added we will come towards process of code. We first have to load
the directory paths from the dataset and confirm that the directory have a similar number
of classes. To conform we will display all classes in each folders of the root directory and
images in some classes to test.
While assembling certifiable AI models, it is very basic to part the dataset into 3 sections:
Training set: used to prepare the model for example process the misfortune and change
loads of the model utilizing inclination drop.
Validation set: used to assess the model while preparing, change hyperparameters
(learning rate, and so on), and pick the best form of the model.
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Test set: used to analyze various models, or various kinds of demonstrating approaches,
and report the last exactness of the model.
For the reasons for this notebook, every one of the pictures remembered for the Training
catalog would be utilized as Training Dataset, and a similar will be for the Test registry
as Validation Dataset. The Test set would the Validation Dataset.
When loading images from the training dataset, "Randomized Data Augmentations" will
apply transformations at random. Specifically, each image will be pad by 10 pixels before
being flipped horizontally with a 50% chance. Finally, a random 20-degree rotation will
be applied. Since the transformation will be applied randomly and dynamically each time
a specific image is loaded.
While you are running AI models you will work with a lot of data. That data should be
handled by a PC, and PCs have restricted assets. It would be inconceivable for a machine
to run every one of the 67692 pictures remembered for this dataset without a moment's
delay. Consequently, you will require data loaders. Fortunately PyTorch has them.
We have to define model using CNN it will be our custom CNN . Let's define an
ImageClassificationBase class and an accuracy function for the models before we get into
the specifics of each one.
The accuracy function will be used to determine how well the model performs. Finding
the number of labels that were correctly predicted, or the precision of the forecasts, is a
natural way to do this.
This custom CNN model's architecture will be built on Residual Blocks and Batch
Normalization. This is so that the effects of the custom CNN and the ResNet
model(ResNet stands for residual neural networks, which are pre-trained models in in the
ImageNet dataset) can be compared. The original input is added back to the output
feature map obtained by moving the input through one or more convolutional layers by
Residual Block. Batch Normalization, as the name implies, normalizes the convolutional
layers' inputs by taking them all to the same size. This cuts down on the time it takes to
train the neural network.
After designing the custom model we have to train data Training the Custom CNN
Model. Then we have to do Training to the ResNet CNN Model which is in a similar
fashion to the custom CNN model.
The training results give the Learning Rate, Training Loss ,Validation Loss ,Validation
Accuracy. The accuracy must be greater then 90% for our models to use in predictions.
With the validation dataset, you can now use the trained models to make predictions. The
predictions would be identical since both models achieved greater than 90% accuracy.
You have to save and commit the notebook in Kaggle using save option. So you can
review your work in future.
Source Code:
import os
import torch
import torchvision
import tarfile
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from torchvision.datasets.utils import download_url
from torchvision.datasets import ImageFolder
from torch.utils.data import DataLoader
import torchvision.transforms as tt
from torch.utils.data import random_split
from torchvision.utils import make_grid
import matplotlib.pyplot as plt
%matplotlib inline
from tqdm.notebook import tqdm
import torchvision.models as models
# Load the directory paths to the dataset
DATA_DIR = '../input/fruits/fruits-360'
TRAIN_DIR = DATA_DIR + '/Training'
TEST_DIR = DATA_DIR + '/Test'
# Look at the root directory
print('The folders inside the root directory are: ')
print(os.listdir(DATA_DIR))
# The classes are the name of the folders inside the Training directory
train_classes = os.listdir(TRAIN_DIR)
print('\nThe classes on the Training directory are: ')
print(train_classes)
print('The Training directory has %s classes.' %len(train_classes))
# The classes are the name of the folders inside the Test directory
test_classes = os.listdir(TEST_DIR)
print('\nThe classes on the Test directory are: ')
print(test_classes)
print('The Training directory has %s classes. \n' %len(test_classes))
print('\nThe images inside the /Training/Apple Red 2 directory are:')
print(os.listdir(TRAIN_DIR + '/Apple Red 2'))
print('\nThe /Training/Apple Red 2 directory has %s images.' %len(os.listdir(TRAIN_DIR + '/A
pple Red 2')))
print('\nThe images inside the /Test/Apple Red 2 directory are:')
print(os.listdir(TEST_DIR + '/Apple Red 2'))
print('\nThe /Test/Apple Red 2 directory has %s images.' %len(os.listdir(TEST_DIR + '/Apple R
ed 2')))
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
train_tfms = tt.Compose([tt.RandomCrop(100, padding=10, padding_mode='reflect'),
tt.RandomHorizontalFlip(),
tt.RandomRotation(20),
tt.ToTensor()
])
valid_tfms = tt.Compose([tt.ToTensor()])
train_ds = ImageFolder(TRAIN_DIR, train_tfms)
valid_ds = ImageFolder(TEST_DIR, valid_tfms)
def show_example_train(img, label):
print('Label: ', train_ds.classes[label], "("+str(label)+")")
plt.imshow(img.permute(1, 2, 0))
print('Image size: ', img.size())
def show_example_test(img, label):
print('Label: ', valid_ds.classes[label], "("+str(label)+")")
plt.imshow(img.permute(1, 2, 0))
print('Image size: ', img.size())
show_example_train(*train_ds[0])
show_example_test(*valid_ds[3695])
batch_size_custom = 32 # Batch size for custom CNN model
batch_size_resnet = 32 # Batch size for resnet CNN model
random_seed = 42
torch.manual_seed(random_seed);
# DataLoaders for Custom CNN Model
train_dl_custom = DataLoader(train_ds, batch_size_custom, shuffle=True, num_workers=3, pin
_memory=True)
valid_dl_custom = DataLoader(valid_ds, batch_size_custom*2, num_workers=3, pin_memory=
True)
# DataLoaders for ResNet CNN Model
train_dl_resnet = DataLoader(train_ds, batch_size_resnet, shuffle=True, num_workers=3, pin_m
emory=True)
valid_dl_resnet = DataLoader(valid_ds, batch_size_resnet*2, num_workers=3, pin_memory=Tru
e)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
def show_batch(dl):
for images, labels in dl:
fig, ax = plt.subplots(figsize=(12, 12))
ax.set_xticks([]); ax.set_yticks([])
ax.imshow(make_grid(images[:64], nrow=8).permute(1, 2, 0))
break
print('train_dl_custom dataloader samples: ')
show_batch(train_dl_custom)
print('valid_dl_custom dataloader samples: ')
show_batch(valid_dl_custom)
print('train_dl_resnet dataloader samples: ')
show_batch(train_dl_resnet)
print('valid_dl_resnet dataloader samples: ')
show_batch(valid_dl_resnet)
torch.cuda.is_available()
def get_default_device():
"""Pick GPU if available, else CPU"""
if torch.cuda.is_available():
return torch.device('cuda')
else:
return torch.device('cpu')
def to_device(data, device):
"""Move tensor(s) to chosen device"""
if isinstance(data, (list,tuple)):
return [to_device(x, device) for x in data]
return data.to(device, non_blocking=True)
class DeviceDataLoader():
"""Wrap a dataloader to move data to a device"""
def __init__(self, dl, device):
self.dl = dl
self.device = device
def __iter__(self):
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
"""Yield a batch of data after moving it to device"""
for b in self.dl:
yield to_device(b, self.device)
def __len__(self):
"""Number of batches"""
return len(self.dl)
device = get_default_device()
device
# Device Data Loader for Custom CNN Model
train_dl_custom = DeviceDataLoader(train_dl_custom, device)
valid_dl_custom = DeviceDataLoader(valid_dl_custom, device)
# Device Data Loader for Custom CNN Model
train_dl_resnet = DeviceDataLoader(train_dl_resnet, device)
valid_dl_resnet = DeviceDataLoader(valid_dl_resnet, device)
def accuracy(outputs, labels):
_, preds = torch.max(outputs, dim=1)
return torch.tensor(torch.sum(preds == labels).item() / len(preds))
class ImageClassificationBase(nn.Module):
def training_step(self, batch):
images, labels = batch
out = self(images)
loss = F.cross_entropy(out, labels) # Calculate training loss
return loss
def validation_step(self, batch):
images, labels = batch
out = self(images) # Generate predictions
loss = F.cross_entropy(out, labels) # Calculate validation loss
acc = accuracy(out, labels) # Calculate accuracy
return {'val_loss': loss.detach(), 'val_acc': acc}
def validation_epoch_end(self, outputs):
batch_losses = [x['val_loss'] for x in outputs]
epoch_loss = torch.stack(batch_losses).mean() # Combine losses
batch_accs = [x['val_acc'] for x in outputs]
epoch_acc = torch.stack(batch_accs).mean() # Combine accuracies
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
return {'val_loss': epoch_loss.item(), 'val_acc': epoch_acc.item()}
def epoch_end(self, epoch, result):
print("Epoch [{}], last_lr: {:.10f}, train_loss: {:.4f}, val_loss: {:.4f}, val_acc: {:.4f}".format(
epoch, result['lrs'][-1], result['train_loss'], result['val_loss'], result['val_acc']))
def conv_block(in_channels, out_channels, pool=False):
layers = [nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1),
nn.BatchNorm2d(out_channels), # Batch Normalization
nn.ReLU(inplace=True)]
if pool: layers.append(nn.MaxPool2d(2))
return nn.Sequential(*layers)
class CustomCNN(ImageClassificationBase):
def __init__(self, in_channels, num_classes):
super().__init__()
self.conv1 = conv_block(in_channels, 128) # 3 x 64 x 64
self.conv2 = conv_block(128, 256, pool=True) # 128 x 32 x 32
self.res1 = nn.Sequential(conv_block(256, 256), conv_block(256, 256)) # 256 x 32 x 32
self.conv3 = conv_block(256, 512, pool=True) # 512 x 16 x 16
self.conv4 = conv_block(512, 1024, pool=True) # 1024 x 8 x 8
self.res2 = nn.Sequential(conv_block(1024, 1024), conv_block(1024, 1024)) # 1024 x 8 x 8
self.conv5 = conv_block(1024, 2048, pool=True) # 256 x 8 x 8
self.conv6 = conv_block(2048, 4096, pool=True) # 512 x 4 x 4
self.res3 = nn.Sequential(conv_block(4096, 4096), conv_block(4096, 4096)) # 512 x 4 x 4
self.classifier = nn.Sequential(nn.MaxPool2d(4), # 9216 x 1 x 1
nn.Flatten(), # 9216
nn.Linear(9216, num_classes)) # 131
def forward(self, xb):
out = self.conv1(xb)
out = self.conv2(out)
out = self.res1(out) + out # Residual Block
out = self.conv3(out)
out = self.conv4(out)
out = self.res2(out) + out # Residual Block
out = self.classifier(out)
return out
# remove the + out to see the differences of adding the output at the end
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
class ResNetCNN(ImageClassificationBase):
def __init__(self):
super().__init__()
# Use a pretrained model
self.network = models.resnet34(pretrained=True) # You can change the resnet model her
e
# Replace last layer
num_ftrs = self.network.fc.in_features
self.network.fc = nn.Linear(num_ftrs, 131) # Output classes
def forward(self, xb):
return torch.sigmoid(self.network(xb))
def freeze(self):
# To freeze the residual layers
for param in self.network.parameters():
param.require_grad = False
for param in self.network.fc.parameters():
param.require_grad = True
def unfreeze(self):
# Unfreeze all layers
for param in self.network.parameters():
param.require_grad = True
@torch.no_grad()
def evaluate(model, val_loader):
print('Evaluating Model ...')
model.eval()
outputs = [model.validation_step(batch) for batch in tqdm(val_loader)]
return model.validation_epoch_end(outputs)
def get_lr(optimizer):
for param_group in optimizer.param_groups:
return param_group['lr']
def fit_one_cycle(epochs, max_lr, model, train_loader, val_loader,
weight_decay=0, grad_clip=None, opt_func=torch.optim.SGD):
torch.cuda.empty_cache()
history = []
# Set up cutom optimizer with weight decay
optimizer = opt_func(model.parameters(), max_lr, weight_decay=weight_decay)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
# Set up one-cycle learning rate scheduler
sched = torch.optim.lr_scheduler.OneCycleLR(optimizer, max_lr, epochs=epochs,
steps_per_epoch=len(train_loader))
for epoch in range(epochs):
# Training Phase
model.train()
train_losses = []
lrs = []
print('\nTraining Model ...')
for batch in tqdm(train_loader):
loss = model.training_step(batch)
train_losses.append(loss)
loss.backward()
# Gradient clipping
if grad_clip:
nn.utils.clip_grad_value_(model.parameters(), grad_clip)
optimizer.step()
optimizer.zero_grad()
# Record & update learning rate
lrs.append(get_lr(optimizer))
sched.step()
# Validation phase
result = evaluate(model, val_loader)
result['train_loss'] = torch.stack(train_losses).mean().item()
result['lrs'] = lrs
model.epoch_end(epoch, result)
history.append(result)
return history
epochs = 10
max_lr = 1e-3
grad_clip = 1e-1
weight_decay = 1e-4
opt_func = torch.optim.Adam
input_channels = 3
output_classes = 131
custom_model = to_device(CustomCNN(input_channels, output_classes), device)
custom_model
for images, labels in train_dl_custom:
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
print('images.shape:', images.shape)
out = custom_model(images)
print('out.shape:', out.shape)
print('out[0]:', out[0])
break
history_CustomCNN = [evaluate(custom_model, valid_dl_custom)]
history_CustomCNN
%%time
history_CustomCNN += fit_one_cycle(epochs, max_lr, custom_model, train_dl_custom, valid_d
l_custom,
grad_clip=grad_clip,
weight_decay=weight_decay,
opt_func=opt_func)
resnet_model = to_device(ResNetCNN(), device)
resnet_model
history_ResNetCNN = [evaluate(resnet_model, valid_dl_resnet)]
history_ResNetCNN
resnet_model.freeze()
%%time
history_ResNetCNN += fit_one_cycle(5, 1e-2, resnet_model, train_dl_resnet, valid_dl_resnet,
grad_clip=grad_clip,
weight_decay=weight_decay,
opt_func=opt_func)
resnet_model.unfreeze()
%%time
history_ResNetCNN += fit_one_cycle(5, 1e-3, resnet_model, train_dl_resnet, valid_dl_resnet,
grad_clip=grad_clip,
weight_decay=weight_decay,
opt_func=opt_func)
def plot_accuracies(history, model_name):
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
accuracies = [x['val_acc'] for x in history]
plt.plot(accuracies, '-x')
plt.xlabel('epoch')
plt.ylabel('accuracy')
plt.title(model_name + ' - Accuracy vs. No. of epochs');
def plot_losses(history, model_name):
train_losses = [x.get('train_loss') for x in history]
val_losses = [x['val_loss'] for x in history]
plt.plot(train_losses, '-bx')
plt.plot(val_losses, '-rx')
plt.xlabel('epoch')
plt.ylabel('loss')
plt.legend(['Training', 'Validation'])
plt.title(model_name + ' - Loss vs. No. of epochs');
def plot_lrs(history, model_name):
lrs = np.concatenate([x.get('lrs', []) for x in history])
plt.plot(lrs)
plt.xlabel('Batch no.')
plt.ylabel('Learning rate')
plt.title(model_name + ' - Learning Rate vs. Batch no.');
plot_accuracies(history_CustomCNN, 'Custom CNN Model')
plot_losses(history_CustomCNN, 'Custom CNN Model')
plot_lrs(history_CustomCNN, 'Custom CNN Model')
plot_accuracies(history_ResNetCNN, 'ResNet CNN Model')
plot_losses(history_ResNetCNN, 'ResNet CNN Model')
plot_lrs(history_ResNetCNN, 'ResNet CNN Model')
def predict_image(img, model):
# Convert to a batch of 1
xb = to_device(img.unsqueeze(0), device)
# Get predictions from model
yb = model(xb)
# Pick index with highest probability
_, preds = torch.max(yb, dim=1)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
# Retrieve the class label
return valid_ds.classes[preds[0].item()]
img, label = valid_ds[2569]
plt.imshow(img.permute(1, 2, 0))
print('Label:', valid_ds.classes[label], ', Predicted:', predict_image(img, custom_model))
img, label = valid_ds[9856]
plt.imshow(img.permute(1, 2, 0))
print('Label:', valid_ds.classes[label], ', Predicted:', predict_image(img, custom_model))
Screenshots:
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
[2] Sound Classification using Deep Learning
Definition: Sound plays an important role in every aspect of human life. Sound is a crucial
component in the development of automated systems in a variety of fields, from personal
security to critical surveillance. While a few systems are already on the market, their reliability is
a problem for their use in real-world scenarios. Recent advances in image classification, where
convolutional neural networks are used to classify images with high precision and at scale, raises
the question of whether these techniques can be applied to other domains, such as sound
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
classification. In this project, we are going to demonstrate how deep learning is used for sound
classification.
Deep learning architectures' learning capabilities can be used to build sound classification
systems that resolve the inefficiencies of traditional systems. We created a sequential model with
the following specifications using the Keras library and TensorFlow. The convolutional neural
network was a two-layer deep architecture with a completely linked final layer and an output
prediction layer.
Some of the real world applications for deep learning are:
Assisting deaf people with their everyday lives
Smart home use cases like 360-degree protection and security capabilities
Industrial uses like predictive maintenance
Steps:
The steps for classifying sound using Deep Learning are as follows:
1) Data Exploration and Visualisation
2) Data Pre-processing and Data Splitting
3) Model Training and Evaluation
4) Model Refinement
Description:
1) Data Exploring and Visualization:
The “Urbansound8K Dataset" will be used because the aim of this Question is to analyze sound
classification. There are 8732 sound samples (=4s) of urban sounds in the dataset, divided into
ten categories: They are
Air Conditioner
Car Horn
Children Playing
Dog bark
Drilling
Engine Idling
Gun Shot
Jackhammer
Siren
Street Music
Then, we'll load a sample from each class and look for any patterns in the results. We'll
load the audio file into an array with librosa, then show the waveform with
librosa.display and matplotlib. Here, we will also add the urbansoundmetadata.csv file
into the panda frame.
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Then, for each of the audio sample files, we'll extract the number of audio channels,
sample rate, and bit-depth.
2) Data Pre-processing and Data Splitting:
In this step, we will need to pre-process the data to make dataset consistent in audio
channels, sample rate and bit-depth.
Librosa load function is used to normalise the data and remove complications of bit-
depths.
We have to extract an MFCC for each audio file in the dataset and store it in a Panda
Dataframe along with it's classification label and encode the categorical text data into
model-understandable numerical data, using sklearn.preprocessing.LabelEncoder
function.
Then. We have to split the dataset into training and testing sets by using
sklearn.model_selection.train_test_split function.
3) Model Training and Evaluation:
In this step, we will need to train the model and review the accuracy on both the training
and test data sets.
Then, we need to create a method to test the model's predictions on a particular
audio.wav file.
4) Model Refinement:
In the previous step, the accuracy for training data and testing data is low. So, to improve
the accuracy we will be using Convolutional Neural Network (CNN) in this step. We’ll then make the output vectors all the same size by zero.
Our output layer will have ten nodes (num labels), which corresponds to the number of
classifications that can be created. The model would then make a prediction based on
which alternative has the best chance of succeeding.
Then, we need to use Keras and a Tensorflow backend to convert our model back to a
Convolutional Neural Network (CNN and start training the dataset with a small number
of epochs and a small batch size because training a CNN can take a long time. If the
output indicates that the model is convergent, we can increase both numbers.
After completing the above process, we can see that training accuracy increased by 6%
and testing accuracy increased by 4%.
We have to use a sample of different sounds that weren't included in either our test or
training data to further validate our model.
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Source Code:
import IPython.display as ipd
ipd.Audio('../UrbanSound Dataset sample/audio/100032-3-0-0.wav')
# Load imports
import IPython.display as ipd
import librosa
import librosa.display
import matplotlib.pyplot as plt
# Class: Air Conditioner
filename = '../UrbanSound Dataset sample/audio/100852-0-0-0.wav'
plt.figure(figsize=(12,4))
data,sample_rate = librosa.load(filename)
_ = librosa.display.waveplot(data,sr=sample_rate)
ipd.Audio(filename)
# Class: Car horn
filename = '../UrbanSound Dataset sample/audio/100648-1-0-0.wav'
plt.figure(figsize=(12,4))
data,sample_rate = librosa.load(filename)
_ = librosa.display.waveplot(data,sr=sample_rate)
ipd.Audio(filename)
# Class: Children playing
filename = '../UrbanSound Dataset sample/audio/100263-2-0-117.wav'
plt.figure(figsize=(12,4))
data,sample_rate = librosa.load(filename)
_ = librosa.display.waveplot(data,sr=sample_rate)
ipd.Audio(filename)
# Class: Dog bark
filename = '../UrbanSound Dataset sample/audio/100032-3-0-0.wav'
plt.figure(figsize=(12,4))
data,sample_rate = librosa.load(filename)
_ = librosa.display.waveplot(data,sr=sample_rate)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
ipd.Audio(filename)
# Class: Drilling
filename = '../UrbanSound Dataset sample/audio/103199-4-0-0.wav'
plt.figure(figsize=(12,4))
data,sample_rate = librosa.load(filename)
_ = librosa.display.waveplot(data,sr=sample_rate)
ipd.Audio(filename)
# Class: Engine Idling
filename = '../UrbanSound Dataset sample/audio/102857-5-0-0.wav'
plt.figure(figsize=(12,4))
data,sample_rate = librosa.load(filename)
_ = librosa.display.waveplot(data,sr=sample_rate)
ipd.Audio(filename)
# Class: Gunshot
filename = '../UrbanSound Dataset sample/audio/102305-6-0-0.wav'
plt.figure(figsize=(12,4))
data,sample_rate = librosa.load(filename)
_ = librosa.display.waveplot(data,sr=sample_rate)
ipd.Audio(filename)
# Class: Jackhammer
filename = '../UrbanSound Dataset sample/audio/103074-7-0-0.wav'
plt.figure(figsize=(12,4))
data,sample_rate = librosa.load(filename)
_ = librosa.display.waveplot(data,sr=sample_rate)
ipd.Audio(filename)
# Class: Siren
filename = '../UrbanSound Dataset sample/audio/102853-8-0-0.wav'
plt.figure(figsize=(12,4))
data,sample_rate = librosa.load(filename)
_ = librosa.display.waveplot(data,sr=sample_rate)
ipd.Audio(filename)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
# Class: Street music
filename = '../UrbanSound Dataset sample/audio/101848-9-0-0.wav'
plt.figure(figsize=(12,4))
data,sample_rate = librosa.load(filename)
_ = librosa.display.waveplot(data,sr=sample_rate)
ipd.Audio(filename)
import pandas as pd
metadata = pd.read_csv('../UrbanSound Dataset sample/metadata/UrbanSound8K.csv')
metadata.head()
print(metadata.class_name.value_counts())
# Load various imports
import pandas as pd
import os
import librosa
import librosa.display
from helpers.wavfilehelper import WavFileHelper
wavfilehelper = WavFileHelper()
audiodata = []
for index, row in metadata.iterrows():
file_name = os.path.join(os.path.abspath('/Volumes/Untitled/ML_Data/Urban Sound/UrbanSo
und8K/audio/'),'fold'+str(row["fold"])+'/',str(row["slice_file_name"]))
data = wavfilehelper.read_file_properties(file_name)
audiodata.append(data)
# Convert into a Panda dataframe
audiodf = pd.DataFrame(audiodata, columns=['num_channels','sample_rate','bit_depth'])
# num of channels
print(audiodf.num_channels.value_counts(normalize=True))
# sample rates
print(audiodf.sample_rate.value_counts(normalize=True))
# bit depth
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
print(audiodf.bit_depth.value_counts(normalize=True))
import librosa
from scipy.io import wavfile as wav
import numpy as np
filename = '../UrbanSound Dataset sample/audio/100852-0-0-0.wav'
librosa_audio, librosa_sample_rate = librosa.load(filename)
scipy_sample_rate, scipy_audio = wav.read(filename)
print('Original sample rate:', scipy_sample_rate)
print('Librosa sample rate:', librosa_sample_rate)
print('Original audio file min~max range:', np.min(scipy_audio), 'to', np.max(scipy_audio))
print('Librosa audio file min~max range:', np.min(librosa_audio), 'to', np.max(librosa_audio))
import matplotlib.pyplot as plt
# Original audio with 2 channels
plt.figure(figsize=(12, 4))
plt.plot(scipy_audio)
# Librosa audio with channels merged
plt.figure(figsize=(12, 4))
plt.plot(librosa_audio)
mfccs = librosa.feature.mfcc(y=librosa_audio, sr=librosa_sample_rate, n_mfcc=40)
print(mfccs.shape)
import librosa.display
librosa.display.specshow(mfccs, sr=librosa_sample_rate, x_axis='time')
def extract_features(file_name):
try:
audio, sample_rate = librosa.load(file_name, res_type='kaiser_fast')
mfccs = librosa.feature.mfcc(y=audio, sr=sample_rate, n_mfcc=40)
mfccsscaled = np.mean(mfccs.T,axis=0)
except Exception as e:
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
print("Error encountered while parsing file: ", file)
return None
return mfccsscaled
# Load various imports
import pandas as pd
import os
import librosa
# Set the path to the full UrbanSound dataset
fulldatasetpath = '/Volumes/Untitled/ML_Data/Urban Sound/UrbanSound8K/audio/'
metadata = pd.read_csv('../UrbanSound Dataset sample/metadata/UrbanSound8K.csv')
features = []
# Iterate through each sound file and extract the features
for index, row in metadata.iterrows():
file_name = os.path.join(os.path.abspath(fulldatasetpath),'fold'+str(row["fold"])+'/',str(row["sli
ce_file_name"]))
class_label = row["class_name"]
data = extract_features(file_name)
features.append([data, class_label])
# Convert into a Panda dataframe
featuresdf = pd.DataFrame(features, columns=['feature','class_label'])
print('Finished feature extraction from ', len(featuresdf), ' files')
from sklearn.preprocessing import LabelEncoder
from keras.utils import to_categorical
# Convert features and corresponding classification labels into numpy arrays
X = np.array(featuresdf.feature.tolist())
y = np.array(featuresdf.class_label.tolist())
# Encode the classification labels
le = LabelEncoder()
yy = to_categorical(le.fit_transform(y))
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
# split the dataset
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(X, yy, test_size=0.2, random_state = 42)
### store the preprocessed data for use in the next notebook
%store x_train
%store x_test
%store y_train
%store y_test
%store yy
%store le
# retrieve the preprocessed data from previous notebook
%store -r x_train
%store -r x_test
%store -r y_train
%store -r y_test
%store -r yy
%store -r le
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D
from keras.optimizers import Adam
from keras.utils import np_utils
from sklearn import metrics
num_labels = yy.shape[1]
filter_size = 2
# Construct model
model = Sequential()
model.add(Dense(256, input_shape=(40,)))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(256))
model.add(Activation('relu'))
model.add(Dropout(0.5))
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
model.add(Dense(num_labels))
model.add(Activation('softmax'))
# Compile the model
model.compile(loss='categorical_crossentropy', metrics=['accuracy'], optimizer='adam')
# Display model architecture summary
model.summary()
# Calculate pre-training accuracy
score = model.evaluate(x_test, y_test, verbose=0)
accuracy = 100*score[1]
print("Pre-training accuracy: %.4f%%" % accuracy)
from keras.callbacks import ModelCheckpoint
from datetime import datetime
num_epochs = 100
num_batch_size = 32
checkpointer = ModelCheckpoint(filepath='saved_models/weights.best.basic_mlp.hdf5',
verbose=1, save_best_only=True)
start = datetime.now()
model.fit(x_train, y_train, batch_size=num_batch_size, epochs=num_epochs, validation_data=(x
_test, y_test), callbacks=[checkpointer], verbose=1)
duration = datetime.now() - start
print("Training completed in time: ", duration)
# Evaluating the model on the training and testing set
score = model.evaluate(x_train, y_train, verbose=0)
print("Training Accuracy: ", score[1])
score = model.evaluate(x_test, y_test, verbose=0)
print("Testing Accuracy: ", score[1])
import librosa
import numpy as np
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
def extract_feature(file_name):
try:
audio_data, sample_rate = librosa.load(file_name, res_type='kaiser_fast')
mfccs = librosa.feature.mfcc(y=audio_data, sr=sample_rate, n_mfcc=40)
mfccsscaled = np.mean(mfccs.T,axis=0)
except Exception as e:
print("Error encountered while parsing file: ", file)
return None, None
return np.array([mfccsscaled])
def print_prediction(file_name):
prediction_feature = extract_feature(file_name)
predicted_vector = model.predict_classes(prediction_feature)
predicted_class = le.inverse_transform(predicted_vector)
print("The predicted class is:", predicted_class[0], '\n')
predicted_proba_vector = model.predict_proba(prediction_feature)
predicted_proba = predicted_proba_vector[0]
for i in range(len(predicted_proba)):
category = le.inverse_transform(np.array([i]))
print(category[0], "\t\t : ", format(predicted_proba[i], '.32f') )
# Class: Air Conditioner
filename = '../UrbanSound Dataset sample/audio/100852-0-0-0.wav'
print_prediction(filename)
# Class: Drilling
filename = '../UrbanSound Dataset sample/audio/103199-4-0-0.wav'
print_prediction(filename)
# Class: Street music
filename = '../UrbanSound Dataset sample/audio/101848-9-0-0.wav'
print_prediction(filename)
# Class: Car Horn
filename = '../UrbanSound Dataset sample/audio/100648-1-0-0.wav'
print_prediction(filename)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
filename = '../Evaluation audio/dog_bark_1.wav'
print_prediction(filename)
filename = '../Evaluation audio/drilling_1.wav'
print_prediction(filename)
filename = '../Evaluation audio/gun_shot_1.wav'
print_prediction(filename)
# sample data weighted towards gun shot - peak in the dog barking sample is simmilar in shape t
o the gun shot sample
filename = '../Evaluation audio/siren_1.wav'
print_prediction(filename)
# retrieve the preprocessed data from previous notebook
%store -r x_train
%store -r x_test
%store -r y_train
%store -r y_test
%store -r yy
%store -r le
import numpy as np
max_pad_len = 174
def extract_features(file_name):
try:
audio, sample_rate = librosa.load(file_name, res_type='kaiser_fast')
mfccs = librosa.feature.mfcc(y=audio, sr=sample_rate, n_mfcc=40)
pad_width = max_pad_len - mfccs.shape[1]
mfccs = np.pad(mfccs, pad_width=((0, 0), (0, pad_width)), mode='constant')
except Exception as e:
print("Error encountered while parsing file: ", file_name)
return None
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
return mfccs
# Load various imports
import pandas as pd
import os
import librosa
# Set the path to the full UrbanSound dataset
fulldatasetpath = '/Volumes/Untitled/ML_Data/Urban Sound/UrbanSound8K/audio/'
metadata = pd.read_csv('../UrbanSound Dataset sample/metadata/UrbanSound8K.csv')
features = []
# Iterate through each sound file and extract the features
for index, row in metadata.iterrows():
file_name = os.path.join(os.path.abspath(fulldatasetpath),'fold'+str(row["fold"])+'/',str(row["sli
ce_file_name"]))
class_label = row["class_name"]
data = extract_features(file_name)
features.append([data, class_label])
# Convert into a Panda dataframe
featuresdf = pd.DataFrame(features, columns=['feature','class_label'])
print('Finished feature extraction from ', len(featuresdf), ' files')
from sklearn.preprocessing import LabelEncoder
from keras.utils import to_categorical
# Convert features and corresponding classification labels into numpy arrays
X = np.array(featuresdf.feature.tolist())
y = np.array(featuresdf.class_label.tolist())
# Encode the classification labels
le = LabelEncoder()
yy = to_categorical(le.fit_transform(y))
# split the dataset
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(X, yy, test_size=0.2, random_state = 42)
import numpy as np
from keras.models import Sequential
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, Conv2D, MaxPooling2D, GlobalAveragePooling2D
from keras.optimizers import Adam
from keras.utils import np_utils
from sklearn import metrics
num_rows = 40
num_columns = 174
num_channels = 1
x_train = x_train.reshape(x_train.shape[0], num_rows, num_columns, num_channels)
x_test = x_test.reshape(x_test.shape[0], num_rows, num_columns, num_channels)
num_labels = yy.shape[1]
filter_size = 2
# Construct model
model = Sequential()
model.add(Conv2D(filters=16, kernel_size=2, input_shape=(num_rows, num_columns, num_ch
annels), activation='relu'))
model.add(MaxPooling2D(pool_size=2))
model.add(Dropout(0.2))
model.add(Conv2D(filters=32, kernel_size=2, activation='relu'))
model.add(MaxPooling2D(pool_size=2))
model.add(Dropout(0.2))
model.add(Conv2D(filters=64, kernel_size=2, activation='relu'))
model.add(MaxPooling2D(pool_size=2))
model.add(Dropout(0.2))
model.add(Conv2D(filters=128, kernel_size=2, activation='relu'))
model.add(MaxPooling2D(pool_size=2))
model.add(Dropout(0.2))
model.add(GlobalAveragePooling2D())
model.add(Dense(num_labels, activation='softmax'))
# Compile the model
model.compile(loss='categorical_crossentropy', metrics=['accuracy'], optimizer='adam')
# Display model architecture summary
model.summary()
# Calculate pre-training accuracy
score = model.evaluate(x_test, y_test, verbose=1)
accuracy = 100*score[1]
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
print("Pre-training accuracy: %.4f%%" % accuracy)
from keras.callbacks import ModelCheckpoint
from datetime import datetime
#num_epochs = 12
#num_batch_size = 128
num_epochs = 72
num_batch_size = 256
checkpointer = ModelCheckpoint(filepath='saved_models/weights.best.basic_cnn.hdf5',
verbose=1, save_best_only=True)
start = datetime.now()
model.fit(x_train, y_train, batch_size=num_batch_size, epochs=num_epochs, validation_data=(x
_test, y_test), callbacks=[checkpointer], verbose=1)
duration = datetime.now() - start
print("Training completed in time: ", duration)
# Evaluating the model on the training and testing set
score = model.evaluate(x_train, y_train, verbose=0)
print("Training Accuracy: ", score[1])
score = model.evaluate(x_test, y_test, verbose=0)
print("Testing Accuracy: ", score[1])
def print_prediction(file_name):
prediction_feature = extract_features(file_name)
prediction_feature = prediction_feature.reshape(1, num_rows, num_columns, num_channels)
predicted_vector = model.predict_classes(prediction_feature)
predicted_class = le.inverse_transform(predicted_vector)
print("The predicted class is:", predicted_class[0], '\n')
predicted_proba_vector = model.predict_proba(prediction_feature)
predicted_proba = predicted_proba_vector[0]
for i in range(len(predicted_proba)):
category = le.inverse_transform(np.array([i]))
print(category[0], "\t\t : ", format(predicted_proba[i], '.32f') )
# Class: Air Conditioner
filename = '../UrbanSound Dataset sample/audio/100852-0-0-0.wav'
print_prediction(filename)
# Class: Drilling
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
filename = '../UrbanSound Dataset sample/audio/103199-4-0-0.wav'
print_prediction(filename)
# Class: Street music
filename = '../UrbanSound Dataset sample/audio/101848-9-0-0.wav'
print_prediction(filename)
# Class: Car Horn
filename = '../UrbanSound Dataset sample/audio/100648-1-0-0.wav'
print_prediction(filename)
filename = '../Evaluation audio/dog_bark_1.wav'
print_prediction(filename)
filename = '../Evaluation audio/drilling_1.wav'
print_prediction(filename)
filename = '../Evaluation audio/gun_shot_1.wav'
print_prediction(filename)
Screenshots:
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Course Title: CS591-Advance Artificial Intelligence StudentName: Namratha Valle, Malemarpuram Chaitanya
sai, Sasidhar Reddy Vajrala, Nagendra Mokara SEMOID#S02023694
StudentEmail: [email protected] Date:04/20/2021
Violations of academic honesty represent a serious breach of discipline and may be considered grounds for disciplinary action, including dismissal
from the University. The University requires that all assignments submitted to faculty members by students be the work of the individual student
submitting the work. An exception would be group projects assigned by the instructor. (Source: SEMO website)
Conclusion:
The results indicate that the Custom Model produced better results than the ResNet Model
implemented in the PyTorch module, even though training took longer time. The Custom Model
was 99.21 percent accurate, while the ResNet Model was just 92.45 percent accurate. In contrast
to the ResNet Model, the Custom Model was able to reduce training and validation losses.
The results of UrbanSound data indicate that our trained model has a Training accuracy of
98.19% and a Testing accuracy of 91.92%.
References:
1. Aguilar, F. (2020, July 19). Fruits, Vegetables and Deep Learning - Level Up Coding. Medium. https://levelup.gitconnected.com/fruits-vegetables-and-deep-learning-
c5814c59fcc9 2. Smales, M. (2021, February 12). Sound Classification using Deep Learning - Mike
Smales. Medium. https://mikesmales.medium.com/sound-classification-using-deep-
learning-8bc2aa1990b7
List of contributions: Every one of us worked in each aspect to accomplish the task and meet the given requirements so that each of us can get a clear idea of the topic.
Demonstration Coding Documentation Sasidhar Reddy Vajrala 25% 25% 25% Namratha Valle 25% 25% 25% Malemarpuram Chaitanya sai 25% 25% 25% Nagendra Mokara 25% 25% 25%