近年來,無人機作為機器人產業中的一個熱門應用領域,得到了蓬勃的發展。無人機,也被稱為無人飛行載具(Unmanned Aerial Vehicle,UAV),是一種能夠在無需駕駛員在機上進行操控的情況下飛行的飛行載具。它可以通過自主控制飛行或者遠端遙控的方式進行操作,這使得無人機在許多領域中廣泛應用,包括物流運輸、搜救救援、環境監測等。 然而,實現無人機的自主飛行並確保其在複雜環境下的安全與效能仍然面臨著挑戰。其中之一是物體偵測和目標追蹤的問題。為了在無人機上實現高效的物體偵測和目標追蹤,本論文提出了一種基於ROS(Robot Operating System)的系統,並將其應用於Tello無人機上。 在本系統中,我們選擇了經過剪枝的YOLOv4架構作為物體偵測模型,這種架構在保持偵測準確性的同時,能夠提供更快的運行速度。同時,我們選擇了SiamMask作為目標追蹤模型,它是一種基於單目標追蹤的方法,能夠實現即時的目標追蹤。此外,我們引入了PID模組用於計算誤差並調整飛行動作,在本系統中,PID模組根據目標物體的位置計算誤差,並通過調整無人機的飛行動作,實現對目標物體的穩定追蹤。 通過飛行實驗的驗證,我們證明了本系統在日常環境中的可行性。經過剪枝的YOLOv4模型提供了高效的物體偵測能力,能夠在即時環境中實現快速的目標檢測。同時,SiamMask模型能夠實現目標的連續追蹤和定位。PID模組能夠準確計算誤差並適應不同的飛行情況,使無人機能夠穩定地追蹤目標物體。;In recent years, UAVs have seen significant growth as a popular application in the robotics industry. Also known as UAVs or Unmanned Aerial Vehicles, these flying vehicles can operate without a pilot on board. They are widely used in various fields such as logistics, search and rescue, and environmental monitoring. However, achieving autonomous flight and ensuring safety and efficiency in complex environments remain challenging. Object detection and target tracking are among the key issues. To address these challenges, this study proposes a ROS-based system applied to the Tello UAV. The system incorporates a pruned YOLOv4 architecture for efficient object detection with faster runtime speeds. Additionally, SiamMask, a single-object tracking method, enables real-time target tracking. A PID module is introduced to compute errors and adjust flight attitude, allowing stable target tracking by adapting to different flight conditions. Through flight experiments, the system′s feasibility in real-world environments has been validated. The pruned YOLOv4 model provides efficient object detection, while the SiamMask model enables continuous target tracking and localization. The PID module accurately calculates errors and adjusts the UAV′s attitude control signals. In summary, this study proposes a ROS-based system for efficient object detection and target tracking on UAVs. The system′s effectiveness in everyday environments contributes to advancing UAV technology.