sipeed / maix_train

k210(MaixPy)/V831 model example train code, include mobilenet classifier and YOLO V2 detector
https://wiki.sipeed.com/maixpy
Apache License 2.0
83 stars 40 forks source link

训练结果不理想,如何调整 #6

Open zhaoshenhao opened 3 years ago

zhaoshenhao commented 3 years ago

我做了一个中文手势数字识别,效果非常不理想。在实际使用中,准确率低到完全无法接受。而且,有几个数字特别强势,比如4/9/8/0。其他数字几乎没有机会。maix_train 提供的训练调整手段非常有限,请指导。谢谢。

使用的时图片分类训练,数据来源这里: https://github.com/tz28/Chinese-number-gestures-recognition

我下载了他们的基础图片包,然后运行他们提供的 data_augmentation.py [程序,最后对图片进行了一些规整,大小调整到224x224,每个数字有1800-2000 张图片。我们没有对instance/config.py做调整。训练结果报告如下: report

另外在启动训练时看到如下WARNING:

Found 14604 images belonging to 11 classes. Found 3645 images belonging to 11 classes. 2021-01-19 16:19:47,171 - [INFO]: train data:14604, valid data:3645 WARNING:tensorflow:From /tf/maix_train/train/classifier/init.py:177: Model.fit_generator (from tensorflow.python.keras.engine.training) is deprecated and will be removed in a future version. Instructions for updating: Please use Model.fit, which supports generators. /usr/local/lib/python3.6/dist-packages/keras_preprocessing/image/image_data_generator.py:716: UserWarning: This ImageDataGenerator specifies featurewise_center, but it hasn't been fit on any training data. Fit it first by calling .fit(numpy_data). warnings.warn('This ImageDataGenerator specifies ' /usr/local/lib/python3.6/dist-packages/keras_preprocessing/image/image_data_generator.py:724: UserWarning: This ImageDataGenerator specifies featurewise_std_normalization, but it hasn't been fit on any training data. Fit it first by calling .fit(numpy_data). warnings.warn('This ImageDataGenerator specifies ' WARNING:tensorflow:sample_weight modes were coerced from ... to ['...'] WARNING:tensorflow:sample_weight modes were coerced from ... to ['...'] Train for 2920 steps, validate for 729 steps

zhaoshenhao commented 3 years ago

我修改了一下batch size 和 epoch,发现 batch size 越小,早期epoch收敛越快。建议默认batch size 改为1。 目前最后一次训练:batch size:2,epoch:100。训练结果如下。

report

haoshuiwuxiang commented 2 years ago

请问后来效果提高了吗,我目前也是在工程中需要用到这个识别,刚用了1000多张进行训练,感觉效果并不好