没有合适的资源?快使用搜索试试~ 我知道了~
首页tensorflow2——10-monkey && ResNet50 &&迁移学习
10-monkey-species 数据集是一个10类不同品种猴子的数据集,这个数据集是从kaggle平台中下载到本地使用的,在这个分类猴子的数据集中我们使用resnet50模型来做迁移学习fine tune,并且最终实现向模型中输入一张图片能够打印出该图片属于哪类猴子品种的结果。 import matplotlib as mpl #画图用的库 import matplotlib.pyplot as plt #下面这一句是为了可以在notebook中画图 %matplotlib inline import numpy as np import sklearn #机器学习算法库 impor
资源详情
资源评论
资源推荐

tensorflow2——10-monkey && ResNet50 &&迁移学习迁移学习
10-monkey-species 数据集是一个10类不同品种猴子的数据集,这个数据集是从kaggle平台中下载到本地使用的,在这个分类
猴子的数据集中我们使用resnet50模型来做迁移学习fine tune,并且最终实现向模型中输入一张图片能够打印出该图片属于哪
类猴子品种的结果。
import matplotlib as mpl #画图用的库
import matplotlib.pyplot as plt
#下面这一句是为了可以在notebook中画图
%matplotlib inline
import numpy as np
import sklearn #机器学习算法库
import pandas as pd #处理数据的库
import os
import sys
import time
import tensorflow as tf
from tensorflow import keras #使用tensorflow中的keras
#import keras #单纯的使用keras
print(tf.__version__)
print(sys.version_info)
for module in mpl, np, sklearn, pd, tf, keras:
print(module.__name__, module.__version__)
2.0.0
sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0)
matplotlib 3.1.2
numpy 1.18.0
sklearn 0.21.3
pandas 0.25.3
tensorflow 2.0.0
tensorflow_core.keras 2.2.4-tf
physical_devices = tf.config.experimental.list_physical_devices('GPU')
assert len(physical_devices) > 0, "Not enough GPU hardware devices available"
tf.config.experimental.set_memory_growth(physical_devices[0], True)
train_dir = "/home/galaxy/DeepLearning/DATASETS/10-Monkey-Species/training/training/"
valid_dir = "/home/galaxy/DeepLearning/DATASETS/10-Monkey-Species/validation/validation/"
label_file = "/home/galaxy/DeepLearning/DATASETS/10-Monkey-Species/monkey_labels.txt"
print(os.path.exists(train_dir))
print(os.path.exists(valid_dir))
print(os.path.exists(label_file))
print(os.listdir(train_dir))
print(os.listdir(valid_dir))
True
True
True
['n9', 'n8', 'n3', 'n1', 'n5', 'n6', 'n2', 'n0', 'n7', 'n4'] ['n9', 'n8', 'n3', 'n1', 'n5', 'n6', 'n2', 'n0', 'n7', 'n4']
labels = pd.read_csv(label_file, header=0)
print(labels)
Label Latin Name Common Name \
0 n0 alouatta_palliata mantled_howler
1 n1 erythrocebus_patas patas_monkey
2 n2 cacajao_calvus bald_uakari
3 n3 macaca_fuscata japanese_macaque
4 n4 cebuella_pygmea pygmy_marmoset
5 n5 cebus_capucinus white_headed_capuchin
6 n6 mico_argentatus silvery_marmoset
7 n7 saimiri_sciureus common_squirrel_monkey
8 n8 aotus_nigriceps black_headed_night_monkey
9 n9 trachypithecus_johnii nilgiri_langur


















安全验证
文档复制为VIP权益,开通VIP直接复制

评论1