# Long Short-Term Memory (LSTM)-Based Dog Activity Detection Using Accelerometer and Gyroscope
###### Abstract
Developing an information ecosystem that can collect data and extract insights to monitor animal activity is one method of keeping an eye on animals. It is quite easy to create a hypothesis from an animal's daily activity if the outcomes of such a sensor device are localized in areas such as farms and yet offices. These theories may be pertinent to future health issues, less stressful conditions for animals, and other issues. There is also another option for recognizing animal activity, called vision-based systems. Data from a camera placed close to the animal are used by computer vision-based approaches [28]. This method has a number of drawbacks, including a high reliance on light, the need for resolution, a constrained viewing area, high costs, and privacy risks. As such, we used a sensor-based methodology to conduct the tests in this work. Data were gathered for our study from 10 dogs of various ages, sexes, breeds, and sizes. The owners of the dogs granted consent for the data to be collected. The data were collected using wearable sensors that were attached to the dogs' necks and tails. The main purpose of this research was to assess how recent approaches to animal welfare translated to pet behavior. Sometimes, dogs experience various health conditions unknown to their owners. We aim to analyze the behavior of dogs by identifying differences in behavior such as walking, sitting, down, staying, eating, sideway, jumping, running, shaking, and nose work, in order to identify special behavioral characteristics using deep learning with long short-term memory (LSTM). Even though academics have put forward a variety of ways, several shortcomings, such as the fact that they mostly employed data only from accelerometer, while others simply used raw data without using feature engineering methods, persist in those methods. In this paper, we took these aspects into account and employed two sensors (an accelerometer and a gyroscope) on the dogs' necks and tails. We also performed feature engineering and used the LSTM model for predicting the dog's activity. There are certain reasons for why we have used LSTM. Since our data are time series data, LSTM gives better performance compared to other neural network architectures. LSTM can store information for a longer time where other neural network technologies cannot do so. For the prediction of future events in time series data, it is important to handle the longer dependencies, so LSTM is best fit for such data. LTSM also helps resolve the vanishing gradient problems which occur while training the model. The following is the summary of our work's major contributions. * It studies the usefulness of machine learning methods to categorize the primary behavior patterns of dogs from sensor data. * Application of popular LSTM deep learning technology to identify the pet activity on collected data from two type of sensors. * We are among the pioneers to use the LSTM approach to identify dog behaviors that consider information from sensors, including an accelerometer and a gyroscope. * We examined 10 types of behavior by applying our proposed LSTM model. * We have employed class weight techniques that have been shown to be suitable for the identification of pet activities to address the imbalance issue. The remainder of this article is divided into the following sections. Related work is briefly summarized in Section 2. The materials and procedures are described in Section 3. The methodology for activity detection is described in Section 4. The discussion and outcomes of the experiments are covered in Section 5. Section 6 draws our research work to a conclusion.