Python + AI 的 21 天挑戰

很久沒有進行一些甚麼甚麼挑戰了, 不如就在這三星期裏跟大家一起編寫一些跟 AI 應用有關的 Python 程式吧!

今次這個「Python + AI 的 21 天挑戰」旨在跟大家在短短三週內初步掌握 Python 編程和人工智慧的基礎知識。內容涵蓋了從基礎語法到實際應用的廣泛內容,讓大家能夠迅速上手並進行創新應用。

在這 21 的小課程裏涵蓋了以下的範疇:
😺 開發環境準備
😸 語音技術
😹 電腦視覺
😻 手部位置及動作檢測
😼 身體姿勢檢測
😽 面部識別技術
🙀 機器學習

由於每一天的文章都會有一定的長度, 為免整篇篇幅過長, 每一篇都會獨立編寫, 請按超連結收看 ^_^


🟡 Day00 (13 Oct 2024) 今天先預備好 Python 的開發環境吧!

先預備好開發環境, 編程才能得心應手喔!
建置 Python 開發環境 (Windows 10 或以上)

🟡 Day01 (14 Oct 2024) 文字轉語音 Text to Speech

這個文字轉語音的範例使用了 Python 的 pyttsx3 模組來實現文字轉語音(Text-to-Speech, TTS)的功能。這個模組是一個跨平台的 TTS 工具, 支持多種語音合成器。有了 TTS 大家的程式便可以透過語音跟使用者互動了!

This text-to-speech example uses the Python library pyttsx3 to implement text-to-speech (TTS) functionality. This module is a cross-platform TTS tool that supports multiple speech synthesizers. With TTS, programs can interact with users through voice!

請按這裏

🟡 Day02 (15 Oct 2024) 語音識別 Speech Recognition

這個程式主要用於錄製音頻並將其轉換為文字。它首先錄製一段音頻, 然後使用語音識別技術將錄製的音頻轉換為文字。這對於需要將語音內容轉換為文字的應用場景非常有用, 如語音筆記、語音命令等。

This program is primarily used to record audio and convert it into text. It first records a segment of audio, then uses speech recognition technology to convert the recorded audio into text. This is particularly useful for applications that require converting spoken content into written text, such as voice notes and voice commands.

請按這裏

🟡 Day03 (16 Oct 2024) 手部關鍵點檢測 Hand Landmarks Detection

今天的程式是利用 OpenCV 和 MediaPipe 來進行即時的手部偵測和關鍵點繪製, 是這類手部偵測程式的基本型, 之後連續幾天會建基於這個程式逐步增加不同的功能。

Today’s program uses OpenCV and MediaPipe for real-time hand detection and keypoint drawing. It serves as a basic model for hand detection programs. Over the next few days, various features will be gradually added to this program.

請按這裏

🟡 Day04 (17 Oct 2024) 手勢辨識 (以數字代表手勢) Hand Posture Recognition

今天的程式是利用 OpenCV 和 MediaPipe 來進行即時的手部偵測, 並判斷每根手指是否伸出, 然後將手指的狀態以二進制及十進制的形式顯示在畫面左上角, 這個程式能將各種手勢轉化為數字, 能大大地降低辨識手勢的難度。

Today’s program uses OpenCV and MediaPipe for real-time hand detection and determines whether each finger is extended. It then displays the state of the fingers in both binary and decimal forms. This program can convert various gestures into numbers, significantly reducing the difficulty of gesture recognition.

請按這裏

🟡 Day05 (18 Oct 2024) 手勢辨識 (過濾不雅手勢) Hand Posture Recognition

最期待的畫面出現了! 今天的程式是利用 OpenCV 和 MediaPipe 進行即時的手部偵測, 並在偵測到使用者舉起中指時, 於畫面中對應的區域添加馬克賽效果。

Today’s program uses OpenCV and MediaPipe for real-time hand detection. When it detects the user raising their middle finger, it adds a mosaic effect to the corresponding area on the screen.

請按這裏

🟡 Day06 (19 Oct 2024) 計算食指尖與姆指尖之間的距離

今天的程式是利用 OpenCV 和 MediaPipe 進行即時手部偵測, 並計算食指指尖和拇指指尖之間的距離。

Today’s program uses OpenCV and MediaPipe for real-time hand detection and calculates the distance between the tip of the index finger and the tip of the thumb.

請按這裏

🟡 Day07 (20 Oct 2024) 偵測手部是否有拍打的動作

今天的程式是利用 OpenCV 和 MediaPipe 進行即時手部偵測, 並估算手部與攝影機之間的距離, 當偵測到類似拍打的動作, 手掌的顏色便會由藍色變成綠色。

Today’s program uses OpenCV and MediaPipe for real-time hand detection and estimates the distance between the hand and the camera. When a slapping motion is detected, the color of the palm changes from blue to green.

請按這裏

🟡 Day08 (21 Oct 2024) 追蹤手部位置及動作並顯示魔法特效

今天的程式是使用 OpenCV 和 MediaPipe 進行即時手部偵測,並在偵測到手部張開時,顯示旋轉的魔法陣特效。

Today’s program uses OpenCV and MediaPipe for real-time hand detection, and when it detects an open hand, it displays a rotating magic circle effect.

請按這裏

🟡 Day09 (22 Oct 2024) 面部偵測 Face Detection

今天這個程式碼範例展示了如何使用 OpenCV 和 MediaPipe 來進行即時面部偵測。程式首先透過攝影機捕捉即時影像, 並會偵測影像中的面部,並使用 MediaPipe 的繪圖工具在影像上標示出偵測到的面部位置。

Today’s program uses OpenCV and MediaPipe for real-time hand detection and keypoint drawing. It serves as a basic model for hand detection programs. Over the next few days, various features will be gradually added to this program.

請按這裏