我们知道,影响训练效果的主要是:
****train_ratio** 、**crop_fix_size**、**crop_ratio**、**lr**
、**batch** 、**epoch****
*****
因此测试一下:
### 一、当**仅改变train_ratio时**:
*****
#### ①**0.8**
train_ratio=0.8
crop_fix_size=(30,30)
crop_ratio=0.6
lr=0.05
batch=10
epoch=20
~~~
Epoch 20/20
369/369 [==============================] - 12s 31ms/step - loss: 0.7828 - acc: 0.6842 - val_loss: 0.8361 - val_acc: 0.6707
~~~
![](https://img.kancloud.cn/43/ab/43abe64768a976108f671cdd96210baf_470x833.png)
*****
②**0.85**
train_ratio=0.85
crop_fix_size=(30,30)
crop_ratio=0.6
lr=0.05
batch=10
epoch=20
~~~
Epoch 20/20
392/392 [==============================] - 10s 26ms/step - loss: 0.7734 - acc: 0.6806 - val_loss: 0.8888 - val_acc: 0.6739
~~~
~~~
The loss: 0.901434063911438, Test accuracy: 0.6681159138679504
~~~
![](https://img.kancloud.cn/3a/c4/3ac4bba41066dd6b8f222fb1f0082b05_630x855.png)
*****
③**0.9**
train_ratio=0.9
crop_fix_size=(30,30)
crop_ratio=0.6
lr=0.05
batch=10
epoch=20
~~~
Epoch 20/20
293/293 [==============================] - 15s 51ms/step - loss: 0.8614 - acc: 0.6695 - val_loss: 0.8607 - val_acc: 0.6740
~~~
~~~
The loss: 0.8515320420265198, Test accuracy: 0.6739726066589355
~~~
![](https://img.kancloud.cn/8e/aa/8eaaf53ad0f63fa7959d311edfe4e954_766x835.png)
*****
### 二、当**固定ratio:0.8,仅改变lr时**:
*****
#### ①**0.03**
train_ratio=0.8
crop_fix_size=(30,30)
crop_ratio=0.6
lr=0.03
batch=10
epoch=20
~~~
Epoch 20/20
293/293 [==============================] - 58s 198ms/step - loss: 1.0009 - acc: 0.5930 - val_loss: 1.0493 - val_acc: 0.5649
~~~
~~~
The loss: 1.063227849872145, Test accuracy: 0.568493127822876
~~~
![](https://img.kancloud.cn/08/98/0898da33e3d45c40f679ef122cd25bb4_509x420.png)
![](https://img.kancloud.cn/b3/10/b310d1135d00a7e108b49095a82d95b8_526x423.png)
#### ②**0.05**
train_ratio=0.8
crop_fix_size=(30,30)
crop_ratio=0.6
lr=0.05
batch=10
epoch=20
~~~
Epoch 20/20
293/293 [==============================] - 58s 198ms/step - loss: 0.9075 - acc: 0.6487 - val_loss: 0.9102 - val_acc: 0.6423
~~~
~~~
The loss: 0.9140146644148108, Test accuracy: 0.6547945141792297
~~~
![](https://img.kancloud.cn/a1/6d/a16da0746494b5d90156e947dd400be5_793x413.png)
![](https://img.kancloud.cn/dc/44/dc440e1d1cd187315ec94fcae1729ae6_798x422.png)
#### ③**0.1**
train_ratio=0.8
crop_fix_size=(30,30)
crop_ratio=0.6
lr=0.1
batch=10
epoch=20
~~~
Epoch 20/20
293/293 [==============================] - 12s 43ms/step - loss: 0.8428 - acc: 0.6856 - val_loss: 0.8485 - val_acc: 0.6795
~~~
~~~
The loss: 0.8455102443695068, Test accuracy: 0.682191789150238
~~~
![](https://img.kancloud.cn/d9/ae/d9ae904829617ef1eb351ee24f22559e_702x452.png)
![](https://img.kancloud.cn/a6/68/a6688685a6cc155b26726460b2729789_638x449.png)
### 三、当**仅改变epoch时**:
*****
#### ①**10**
train_ratio=0.8
crop_fix_size=(30,30)
crop_ratio=0.6
lr=0.05
batch=10
epoch=10
~~~
Epoch 10/10
293/293 [==============================] - 12s 42ms/step - loss: 1.1422 - acc: 0.5048 - val_loss: 1.1555 - val_acc: 0.5027
~~~
~~~
The loss: 1.1439930200576782, Test accuracy: 0.4890410900115967
~~~
![](https://img.kancloud.cn/67/86/6786ef13717e9e8aa04bb4d677d1c408_645x449.png)
![](https://img.kancloud.cn/81/af/81afd5262c80a0dc6c8598fe47345b12_574x449.png)
#### ②**30**
train_ratio=0.8
crop_fix_size=(30,30)
crop_ratio=0.6
lr=0.05
batch=10
epoch=30
~~~
Epoch 30/30
293/293 [==============================] - 12s 43ms/step - loss: 0.7440 - acc: 0.7119 - val_loss: 0.8707 - val_acc: 0.6575
~~~
~~~
The loss: 0.8830211758613586, Test accuracy: 0.6602739691734314
~~~
![](https://img.kancloud.cn/0d/6b/0d6bae84e997607f291cd7c5b8448088_565x444.png)
![](https://img.kancloud.cn/d5/46/d5464b8248c3b0aa1213b88e20cdaac8_638x446.png)
#### ③**40**
~~~
Epoch 28/40
293/293 [==============================] - 12s 43ms/step - loss: 0.7773 - acc: 0.7078 - val_loss: 0.8821 - val_acc: 0.6671
~~~
~~~
The loss: 0.882400631904602, Test accuracy: 0.6767123341560364
~~~
![](https://img.kancloud.cn/1c/90/1c9015b5e5f9214d4246ec157cf8db83_533x448.png)
![](https://img.kancloud.cn/c5/3c/c53c7c98c9cacd5333538e113ad73e93_596x445.png)
### 四、当**仅改变crop_ratio时**:
*****
#### ①**0.5**
train_ratio=0.8
crop_fix_size=(30,30)
crop_ratio=0.5
lr=0.05
batch=10
epoch=20
~~~
Epoch 20/20
293/293 [==============================] - 13s 44ms/step - loss: 0.8767 - acc: 0.6500 - val_loss: 0.9435 - val_acc: 0.6219
~~~
~~~
The loss: 0.9300558567047119, Test accuracy: 0.6164383292198181
~~~
![](https://img.kancloud.cn/0d/87/0d8734e6aaab8d536ba8481df549a341_670x448.png)
![](https://img.kancloud.cn/1f/41/1f41ca033d21658330abc9c8a5e97e1e_593x452.png)
#### ②**0.8**
train_ratio=0.8
crop_fix_size=(30,30)
crop_ratio=0.8
lr=0.05
batch=10
epoch=20
~~~
Epoch 20/20
293/293 [==============================] - 12s 43ms/step - loss: 0.9282 - acc: 0.6452 - val_loss: 0.8859 - val_acc: 0.6548
~~~
~~~
The loss: 0.8911147117614746, Test accuracy: 0.6424657702445984
~~~
![](https://img.kancloud.cn/97/13/9713dee46d85144dd191e2d481113171_562x450.png)
![](https://img.kancloud.cn/cf/93/cf9318456029eb586581d145e34553c5_531x448.png)