According to the WHO report in 2013, the world population aging over 60 years is predicted to increase to 20 million in 2050. Aging comes about many challenges to elders due to their cognitive decline, chronic age-related diseases, as well as limitations in physical activity, vision, and hearing. Recent advances in wearable computing and mobile health technology create new opportunity for ambient assisted living system to help the person perform the activities safely and independently. The activity monitoring of daily living is the core technique of the ambient assisted living system. Several well-known approaches have utilized various sensors for activity recognition such as camera, RFID, infrared detector and inertial sensor. Since the activities are well characterized by the objects, location or hand gesture that are manipulated during their performance on activities of daily living. However, some applications included, e.g. the monitoring of specific tasks and/or movements in a rehabilitation scenario or the classification of dietary intake gestures for an automated nutrition monitoring system, where reliable activity recognition on a more fine-grained level is needed. To fulfill the requirement, we design a hierarchical window approach based on the dynamic time warping algorithm to achieve fine-grained activity recognition, where the template selection and threshold configuration is developed to cope with the ambiguity with similar features. Furthermore, a confidence estimation for the pattern matching is also proposed. The recognition procedure was successfully adapted to the investigated cleaning tasks. The overall performance in precision, recall, and F1-socre is 89.0%, 88.6%, and 88.1% respectively. The results of the experiment demonstrate that the proposed mechanism is reliable and fulfills the requirements of the ambient assisted living.