没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
A Beginner Image Classification
Walkthrough With Tensorflow 2.0
From housing price prediction, music recognition and face detection
to the recreation of Van Gogh’s artworks, neural networks are quite
taking over the data science scene and becoming an essential tool in
the toolbox of the modern day data scientist. Neural networks are not
only wielded to solve highly complex problems, they also have higher
computational power and greater performance ability than common
algorithms when dealing with larger datasets. Furthermore, the
recent release of Tensorflow 2.0 has enabled beginners like you and I
to learn how to build models easily.
This article isn’t going to show you how to build the best model, but
my hope is that you walk away with a deepened understanding and a
richer appreciation of neural networks.
For this, we will work through the dog versus cats dataset. The goal is
to build a deep learning model that will take in an image and
differentiate between a cat image and a dog image. The criteria for a
good model is a high accuracy. There is also multiclass classification,
e.g. differentiating between different dog species, and the interested
learner can delve deeper into that after covering the foundations. But
for simplicity’s sake, we will work through a binary classification
problem.
Jagerynn Ting Verano
F
o
ll
ow
Jun 6
·
8 min read
(Image Source)
The Need For DeepModels
While deep learning and neural networks are used interchangeably,
they are not the same. Deep models, as opposed to shallow models,
have more layers hidden within the network.
Typically, more layers mean more information can be extracted from
the data. In the case of speech recognition, the first layer may pick up
simple things such as white noise, while the third or fourth layer
picks up finer details like words, and eventually the machine is able to
combine phrases and full sentences.
A greater depth with smaller hidden layers is also said to be less
computationally expensive compared to a shallow yet large network.
We will touch more on these as we go along.
A Brief Overview of the Dog v.
CatsDataset
A Comparison of Shallow vs. Deep Neural Networks(source)
The zip file consists of training and validation files.
Because of the ease of using dataframes, I converted the train and
validation datasets into dataframes. This can be done by creating two
lists: one of file names and the other a corresponding label for cats
and dogs.
animal = []
train_cat_fnames2 = []
for cat in train_cat_fnames: #do the same for dog file
names
animal.append(“cat”)
cat2 = train_cats_dir + "/" + cat #create absolute
path
train_cat_fnames2.append(cat2)
train_df = pd.DataFrame() #create dataframe
train_df[“filename”] =
test_dog_fnames2+test_cat_fnames2
train_df[“animal”] = animal
Plotting via matplotlib also allowed me to get an idea of what each
case looked like, as shown below:
#pass absolute file through load_img
image = load_img(train_df[“filename”][0])
plt.imshow(image)
剩余13页未读,继续阅读
资源评论
tox33
- 粉丝: 64
- 资源: 304
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功