# AI4kids課程合作_東吳大學程式原始碼 ###### tags: `東吳大學` ## 巨資學院高中營隊種子講師培訓 ### <u>即時數字手寫辨識</u>範例程式 1. Notebook 下載:[https://drive.google.com/uc?export=download&id=1kHUUVgLHVv7bvX3T1HNsfVyusNoot0Pt](https://drive.google.com/uc?export=download&id=1kHUUVgLHVv7bvX3T1HNsfVyusNoot0Pt) 2. 程式原作:[https://github.com/surya-veer/RealTime-DigitRecognition](https://github.com/surya-veer/RealTime-DigitRecognition) 3. 修改說明 |原作程式檔名|修改說明| |---|---| |`app.py`|1. 修改為 Jupyter Notebook 版本<br />2. 工具程式 `process_image.py` 和 pre-trained model 改為從 Notebook 中進行下載<br />3. 避免頻繁寫入檔案造成失敗, 寫檔後加入 sleep 1 秒| |`process_image.py`|1. TensorFlow 語法改為 2.0 以後適用, 使用內建的 Keras 而非獨立的 Keras<br />2. Pre-trained model 改為自己的 h5 而非使用原作者的<br />3. cv2.findContours() 修正為 OpenCV 4 適用的版本 (回傳值不同)<br />4. Mac 版修改強制重新變更型別,修改如下程式碼。| |`mnist_cnn.h5`|Pre-trained model 為一層 CNN 的 model, 資料集為 MNIST, 講師可以替換為任一 MNIST 的 model| 4. `process_image.py` Mac 版修改 原程式 ```python return np.argmax(model.predict(test_image)) ``` 修改為 ```python return np.argmax(model.predict(np.array(test_image, dtype='float32'))) ``` 5. Win10 的 tensorflow 2.x 要能正常運作,必須先安裝最新版的 Redistributable packages for Visual Studio 2015, 2017 and 2019: https://aka.ms/vs/16/release/vc_redist.x64.exe --- ### <u>Quick, Draw 貓狗辨識</u>範例程式 Colab URL:[https://colab.research.google.com/drive/1Rux-b06q3u_si7G7ftVysLL5k4pVaZ7a](https://colab.research.google.com/drive/1Rux-b06q3u_si7G7ftVysLL5k4pVaZ7a) 修改說明: - 本機或是 Colab 均可執行範例程式 - 資料集改為直接下載, 省略書中`4.1 準備資料集(Dataset)`的3個步驟,建議可將該節改省為資料集說明。