[Keras] Model API / dataset Zoo
Ref: https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.md
Keras
Keras专门提供的API
一、模型API
Keras doc: https://keras.io/applications/#mobilenet
Keras 如何训练 mobilenet_v1_025_224 等不同种类的模型。
keras.applications.mobilenet.MobileNet(input_shape=None, alpha=1.0, depth_multiplier=1, dropout=1e-3, include_top=True, weights='imagenet', input_tensor=None, pooling=None, classes=1000)
更多的模型,参考:https://keras.io/zh/applications/
Ref: 我的Keras使用总结(4)——Application中五款预训练模型学习及其应用
二、自定义参数
下载pretrained model的链接如下:
mobilenet_1_0_128_tf.h5 16.4 MB
mobilenet_1_0_128_tf_no_top.h5 16.4 MB
mobilenet_1_0_160_tf.h5 16.4 MB
mobilenet_1_0_160_tf_no_top.h5 16.4 MB
mobilenet_1_0_192_tf.h5 16.4 MB
mobilenet_1_0_192_tf_no_top.h5 16.4 MB
mobilenet_1_0_224_tf.h5 16.4 MB
mobilenet_1_0_224_tf_no_top.h5 16.4 MB
mobilenet_2_5_128_tf.h5 2.01 MB
mobilenet_2_5_128_tf_no_top.h5 2.01 MB
mobilenet_2_5_160_tf.h5 2.01 MB
mobilenet_2_5_160_tf_no_top.h5 2.01 MB
mobilenet_2_5_192_tf.h5 2.01 MB
mobilenet_2_5_192_tf_no_top.h5 2.01 MB
mobilenet_2_5_224_tf.h5 2.01 MB
mobilenet_2_5_224_tf_no_top.h5 2.01 MB
mobilenet_5_0_128_tf.h5 5.32 MB
mobilenet_5_0_128_tf_no_top.h5 5.32 MB
mobilenet_5_0_160_tf.h5 5.32 MB
mobilenet_5_0_160_tf_no_top.h5 5.32 MB
mobilenet_5_0_192_tf.h5 5.32 MB
mobilenet_5_0_192_tf_no_top.h5 5.32 MB
mobilenet_5_0_224_tf.h5 5.32 MB
mobilenet_5_0_224_tf_no_top.h5 5.32 MB
mobilenet_7_5_128_tf.h5 10.1 MB
mobilenet_7_5_128_tf_no_top.h5 10.1 MB
mobilenet_7_5_160_tf.h5 10.1 MB
mobilenet_7_5_160_tf_no_top.h5 10.1 MB
mobilenet_7_5_192_tf.h5 10.1 MB
mobilenet_7_5_192_tf_no_top.h5 10.1 MB
mobilenet_7_5_224_tf.h5 10.1 MB
mobilenet_7_5_224_tf_no_top.h5 10.1 MB
迁移学习改变最后一层,diff后有何效果?
xxd file1.bin > file1.hex xxd file2.bin > file2.hex diff file1.hex file2.hex
7.6M 的0.75depth的tfite,通过diff可以缩减到2.9M。

3.5M 的0.50depth的tfite,通过diff可以缩减到2.0M,压缩到753KB.

978KB 的0.25depth的tfite,通过diff会增加到1.1M,,压缩到412KB.

TF Keras 提供的 API
Ref: Retrain a classification model on-device with weight imprinting [不怎么好使]
Keras 数据集
Ref: keras-boston房价回归
from keras.datasets import boston_housing # boston房价数据集,预测房价变化 (train_data, train_targets), (test_data, test_targets) = boston_housing.load_data()

数据集都有以下14个属性:
-
- CRIM--城镇人均犯罪率 ------【城镇人均犯罪率】
- ZN - 占地面积超过25,000平方英尺的住宅用地比例。 ------【住宅用地所占比例】
- INDUS - 每个城镇非零售业务的比例。 ------【城镇中非商业用地占比例】
- CHAS - Charles River虚拟变量(如果是河道,则为1;否则为0 ------【查尔斯河虚拟变量,用于回归分析】
- NOX - 一氧化氮浓度(每千万份) ------【环保指标】
- RM - 每间住宅的平均房间数 ------【每栋住宅房间数】
- AGE - 1940年以前建造的自住单位比例 ------【1940年以前建造的自住单位比例 】
- DIS -波士顿的五个就业中心加权距离 ------【与波士顿的五个就业中心加权距离】
- RAD - 径向高速公路的可达性指数 ------【距离高速公路的便利指数】
- TAX - 每10,000美元的全额物业税率 ------【每一万美元的不动产税率】
- PTRATIO - 城镇的学生与教师比例 ------【城镇中教师学生比例】
- B - 1000(Bk - 0.63)^ 2其中Bk是城镇黑人的比例 ------【城镇中黑人比例】
- LSTAT - 人口状况下降% ------【房东属于低等收入阶层比例】
- MEDV - 自有住房的中位数报价, 单位1000美元 ------【自住房屋房价中位数】
TensorFlow Hub
参考:Retrain a MobileNet V1 or V2 model and use it in the browser with TensorFlow.js.
/* TODOLIST */

浙公网安备 33010602011771号