Welcome to the Human Activity Recognition (HAR) System repository. This project is a demonstration of a scalable, ontology-based, fully probabilistic Human Activity Recognition system, implemented with modern web technologies and designed with a focus on high-quality, responsive user interfaces.
- Introduction
- Features
- Demo
- Architecture
- Installation
- Usage
- Project Structure
- Configuration
- Dependencies
- Contributing
- License
- References
- Acknowledgments
- Contact
This project showcases a Human Activity Recognition (HAR) system that addresses uncertainty and scalability challenges by leveraging probabilistic ontologies and relational databases. The system maintains multiple candidate activities with associated probabilities, enhancing flexibility and accuracy in recognizing human activities from sensor data.
Key Highlights:
- Modern UI/UX Design: The application features a sleek, responsive interface with interactive elements and smooth hover effects, enhancing user engagement.
- Responsive Design: Ensures optimal viewing experience across a wide range of devices, from desktops to mobile phones.
- High-Quality Codebase: Structured with best practices in mind, making the codebase maintainable and scalable.
- Probabilistic Reasoning: Handles uncertainties in sensor data by maintaining probabilities for multiple activity candidates.
- Ontology-Based Modeling: Uses ontologies to represent activities, sensors, and their relationships.
- Scalable Architecture: Employs relational databases for efficient storage and processing of large datasets.
- Data Smoothing: Implements probabilistic data smoothing techniques to enhance prediction accuracy.
- Customizable Axioms: Allows users to define or adjust assertion axioms that relate low-level observations to high-level activities.
- Modern User Interface: Features a responsive design with interactive buttons, hover effects, and intuitive navigation.
- Real-Time Data Streaming: Provides real-time updates of recognized activities and sensor data.
- Admin Dashboard: Offers administrative functionalities, including system control and axiom management.
- User Dashboard: Presents users with current activity recognition in an accessible format.
Click the image above to watch a demo of the HAR system in action.
The system is composed of the following main components:
- Sensor Data Collection: Simulates or interfaces with sensors to collect raw data.
- Data Preprocessing: Cleans data, extracts features, and classifies low-level activities with associated probabilities.
- Ontology Definition and Population: Defines the ontology schema and populates it with instances based on the sensor data.
- Probabilistic Reasoning: Applies assertion axioms to infer high-level activities from low-level observations.
- Database Interaction: Stores data and axioms in a relational database, enforcing probabilistic constraints.
- User Interface: Provides visualization of recognized activities and tools for editing assertion axioms.
- Real-Time Streaming: Implements WebSocket connections for real-time data updates. Workflow Overview:
- Data Collection: Sensors collect raw data at regular intervals.
- Preprocessing: Data is cleaned and features are extracted. Low-level activities are classified probabilistically.
- Ontology Population: Instances representing observations are added to the ontology.
- Reasoning: Probabilistic reasoning is performed to infer high-level activities.
- Storage: Data and inference results are stored in a relational database.
- User Interaction: Users can view recognized activities and adjust assertion axioms through the responsive web interface.
- Node.js (v14 or higher)
- npm or yarn
- SQLite (or another relational database system)
- TypeScript (Installed globally or via npm)
- Clone the Repositorygit clone https://github.com/yourusername/har-system.git cd har-system
- Install Dependenciesnpm install
- Set Up the Database
- The application uses SQLite by default.
- The
DatabaseManager
class indatabaseManager.ts
will create the necessary tables upon initialization. - You can populate the database with fake data using the provided script:sqlite3 har_database.db < populate_fake_data.sql
- Configure the Application
- Copy
config/config.example.ts
toconfig/config.ts
:cp src/config/config.example.ts src/config/config.ts - Adjust settings in
config.ts
as needed.
- Copy
- Build the Applicationnpm run build
- Start the Applicationnpm run dev
- **Development Mode:**npm run dev
- **Production Mode:**npm run build npm run serve
- Access the admin dashboard at
http://localhost:3000/admin
. - Features:
- Start/Stop System: Control the HAR system's data processing.
- Real-Time Sensor Data: View live updates of sensor readings and activity probabilities.
- Edit Axioms: Modify assertion axioms via an intuitive interface with responsive forms and hover effects.
- Access the user dashboard at
http://localhost:3000/
. - Features:
- Current Activity Display: Shows the recognized high-level activity with smooth transitions and animations.
- Responsive Design: Adapts to various screen sizes, providing an optimal viewing experience on any device.
- Accessible from the admin dashboard.
- Features:
- Interactive Forms: Add or modify axioms with real-time validation.
- Modern UI Elements: Utilize sliders, dropdowns, and toggle switches with hover and focus effects.
har-system/
├── src/
│ ├── classification/
│ ├── config/
│ │ ├── config.example.ts
│ │ └── config.ts
│ ├── context/
│ ├── database/
│ ├── ontology/
│ ├── preprocessing/
│ ├── reasoning/
│ ├── sensors/
│ ├── services/
│ ├── ui/
│ │ ├── components/
│ │ ├── pages/
│ │ │ ├── AdminDashboard.tsx
│ │ │ ├── UserDashboard.tsx
│ │ │ ├── AxiomEditor.tsx
│ │ │ ├── LoginPage.tsx
│ │ │ └── NotFoundPage.tsx
│ │ ├── App.tsx
│ │ ├── index.css
│ │ └── index.tsx
│ └── main.tsx
├── public/
│ └── index.html
├── .gitignore
├── package.json
├── tsconfig.json
├── vite.config.ts
├── tailwind.config.js
├── postcss.config.js
├── README.md
└── LICENSE
The config.ts
file contains configuration settings for the application.
// src/config/config.ts
export const DATABASE_NAME = 'har_database.db';
export const SENSOR_IDS = [1, 2, 3, 4];
export const SAMPLING_RATE = 0.33; // Time in seconds between samples
export const ONTOLOGY_FILE = 'har_ontology.owl';
export const WEBSOCKET_PORT = 8080;
Adjust these settings as needed for your environment.
The project relies on modern web technologies and libraries, including:
- React with TypeScript
- Vite for fast development builds
- Tailwind CSS for utility-first styling
- TypeORM for database interaction
- WebSockets for real-time data streaming
- React Router for client-side routing
- Additional packages:
react-router-dom
,ws
,typeorm
,sqlite3
, etc. Install all dependencies using:
npm install
Contributions are welcome! Please follow these steps:
- Fork the Repository
- Create a Feature Branchgit checkout -b feature/your-feature-name
- Commit Your Changesgit commit -am 'Add a new feature'
- Push to the Branchgit push origin feature/your-feature-name
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Paper: Pouya Foudeh and Naomie Salim, An Ontology-Based, Fully Probabilistic, Scalable Method for Human Activity Recognition. Access the Paper
- React Documentation: https://reactjs.org/docs/getting-started.html
- TypeScript Documentation: https://www.typescriptlang.org/docs/
- Tailwind CSS Documentation: https://tailwindcss.com/docs
- Vite Documentation: https://vitejs.dev/guide/
- TypeORM Documentation: https://typeorm.io/#/
We would like to thank Pouya Foudeh and Naomie Salim for their foundational work in probabilistic ontology-based human activity recognition, which inspired this project.
For questions, suggestions, or support, please open an issue or contact [email protected].
This README provides comprehensive guidance on setting up and using the HAR system based on the framework described in the referenced paper, with a focus on modern UI/UX design and high-quality code standards.
(Note: Replace the placeholder text with actual screenshots of your application)
- Features:
- Start/Stop system controls with responsive buttons.
- Real-time sensor data display with hover effects.
- Navigation links to other admin functionalities.
- Features:
- Displays the current recognized activity.
- Responsive layout adapting to different screen sizes.
- Smooth transitions and animations.
- Features:
- Interactive form for adding/editing axioms.
- Real-time validation and feedback.
- Modern UI elements with focus and hover effects.
- Responsive Buttons:/* Example Tailwind CSS classes for buttons */
The application is built with mobile-first principles, ensuring accessibility and usability across various devices.
- Grid Layouts:
- Uses CSS grids and flexbox for flexible layouts.
- Components rearrange themselves based on screen size.
- Media Queries:
- Tailwind CSS simplifies the use of media queries.
- Adjusts font sizes, margins, and paddings for optimal readability.
Interactive elements incorporate hover effects to provide immediate feedback.
- Button Hover Effects:
- Change in background color or shadow on hover.
- Indicates that the element is clickable.
- Link Underlines:
- Underlines appear when hovering over links, signaling interactivity.
- Authentication and Authorization:
- Implement secure authentication mechanisms.
- Role-based access control for admin and user functionalities.
- Advanced Analytics:
- Include charts and graphs for data visualization.
- Historical data analysis and reporting.
- Integration with Real Sensors:
- Interface with actual sensor hardware for real-world deployment.
- Expand support for various sensor types.
If you encounter any issues or have questions, please:
- Check the Issues section to see if the problem has already been reported.
- Open a new issue with detailed information about the problem.
- Contact the maintainer at [email protected] for direct assistance.
Home • Getting Started • Project Overview • Contributing • FAQ
© 2023 HAR System Project. All rights reserved.