|
1 |
| -# Contents |
2 |
| -1. [`Backend`](#Backend) |
3 |
| -2. [`Project Description (PictoPy)`](#PictoPy) |
| 1 | +# PictoPy |
4 | 2 |
|
5 |
| -# Backend |
6 |
| -## Steps to run backend |
| 3 | +PictoPy is an advanced desktop gallery application that combines the power of Tauri, React, and Rust for the frontend with a Python backend for sophisticated image analysis and management. |
7 | 4 |
|
8 |
| -1. Head over to `/backend` after cloning |
9 |
| -2. Create a virtual env by running: `python3 -m venv venv` |
10 |
| -3. Activate the env by running `source venv/bin/activate` and install dependancies via `pip install requirments.txt` |
11 |
| -4. Start the server via `./run.sh` (for development mode add the flag `--test` [RECOMMENDED]) |
12 |
| -5. The server should now be hosted on port `8000` on localhost. |
| 5 | +## Architecture |
13 | 6 |
|
14 |
| -## Some pointers for the backend |
| 7 | +### Frontend |
| 8 | +- **Tauri**: Enables building the desktop application |
| 9 | +- **React**: Used for creating the user interface |
| 10 | +- **Rust**: Powers the backend, which the frontend communicates with through Tauri's API |
15 | 11 |
|
16 |
| -- Entry point is `main.py` which calls the routes, currently there is a `/test` route for developing, to test an image, send a request to the backend (`localhost:8000/test/return`) with the following Body format: |
17 |
| -``` |
18 |
| -{ |
19 |
| - "path": "<Path to image>" |
20 |
| -} |
| 12 | +### Backend (Python) |
| 13 | +- **FastAPI**: Serves as the API framework |
| 14 | +- **SQLite**: Database for storing metadata and embeddings |
| 15 | +- **YOLO**: Used for object detection |
| 16 | +- **FaceNet**: Generates face embeddings |
| 17 | +- **ONNX Runtime**: Runs the models efficiently |
| 18 | +- **DBSCAN**: Performs clustering for face embeddings |
| 19 | + |
| 20 | +### Backend (Rust via Tauri) |
| 21 | +Handles file system operations and provides a secure bridge between the frontend and local system. |
| 22 | + |
| 23 | +## Features |
| 24 | + |
| 25 | +- Smart tagging of photos based on detected objects, faces, and their recognition |
| 26 | +- Traditional gallery features of album management |
| 27 | +- Advanced image analysis with object detection and facial recognition |
| 28 | +- Privacy-focused design with offline functionality |
| 29 | +- Efficient data handling and parallel processing |
| 30 | +- Smart search and retrieval |
| 31 | +- Cross-platform compatibility |
| 32 | + |
| 33 | +## Technical Stack |
| 34 | + |
| 35 | +| Component | Technology | |
| 36 | +| --------- | ---------- | |
| 37 | +| Frontend | React | |
| 38 | +| Desktop Framework | Tauri | |
| 39 | +| Rust Backend | Rust | |
| 40 | +| Python Backend | Python | |
| 41 | +| Database | SQLite | |
| 42 | +| Image Processing | OpenCV, ONNX Runtime | |
| 43 | +| Object Detection | YOLOv8 | |
| 44 | +| Face Recognition | FaceNet | |
| 45 | +| API Framework | FastAPI | |
| 46 | +| State Management | React Hooks | |
| 47 | +| Styling | Tailwind CSS | |
| 48 | +| Routing | React Router | |
| 49 | +| UI Components | Radix UI | |
| 50 | +| Build Tool | Vite | |
| 51 | +| Type Checking | TypeScript | |
| 52 | + |
| 53 | +## Setup |
| 54 | + |
| 55 | +### Frontend Setup |
| 56 | + |
| 57 | +#### Prerequisites |
| 58 | +- Node.js (LTS version recommended) |
| 59 | +- npm (comes with Node.js) |
| 60 | +- Rust (latest stable version) |
| 61 | +- Tauri CLI |
| 62 | + |
| 63 | +#### Installation |
| 64 | +1. Navigate to the frontend directory: |
| 65 | + ```bash |
| 66 | + cd frontend |
| 67 | + ``` |
| 68 | +2. Install dependencies: |
| 69 | + ```bash |
| 70 | + npm install |
| 71 | + ``` |
| 72 | + |
| 73 | +#### Running the Application |
| 74 | +```bash |
| 75 | +npm run tauri dev |
21 | 76 | ```
|
22 |
| -Eg: try it out with path as`backend/tests/inputs/zidane.jpg` |
23 |
| -- A window should pop up showing the highlighted detections, simply press `q` to exit, or comment out the `cv2` lines in `test.py` |
24 |
| -- Change the type of inference by changing `model_path` variable in `app/test` route, by default there are two models available in the `app/models` directory (face and object deteciton). |
25 |
| -# PictoPy |
26 | 77 |
|
27 |
| -An open source image sorting tool designed to organize your image collection efficiently. |
| 78 | +#### Building for Production |
| 79 | +```bash |
| 80 | +npm run tauri build |
| 81 | +``` |
28 | 82 |
|
29 |
| -## Features to be Implemented |
| 83 | +### Python Backend Setup |
30 | 84 |
|
31 |
| -1. **A dedicated Local Database:** |
32 |
| - - A dedicated local database for caching tags, significantly improving the speed and efficiency of image sorting. |
| 85 | +#### Installation |
| 86 | +1. Navigate to the backend directory: |
| 87 | + ```bash |
| 88 | + cd backend |
| 89 | + ``` |
| 90 | +2. Set up a virtual environment (recommended) |
| 91 | +3. Install requirements: |
| 92 | + ```bash |
| 93 | + pip install -r requirements.txt |
| 94 | + ``` |
33 | 95 |
|
34 |
| -2. **Image Recognition Library:** |
35 |
| - - Uses an advanced image recognition library for evaluating objects in images along with faces, ensuring a smoother and more accurate sorting process. |
| 96 | +#### Running the Backend |
| 97 | +For UNIX-based systems: |
| 98 | +```bash |
| 99 | +./run.sh --test |
| 100 | +``` |
36 | 101 |
|
37 |
| -3. **Improved UI/UX:** |
38 |
| - - A smooth user interface for a more intuitive and pleasant experience. |
| 102 | +The backend should now be running on port 8000 by default. |
39 | 103 |
|
40 |
| -4. **Multiprocessing Support:** |
41 |
| - - Pictopy should supports multiprocessing, optimizing the sorting process and improving overall performance. |
| 104 | +## Additional Resources |
| 105 | +- [Tauri Documentation](https://tauri.app/v1/guides/) |
| 106 | +- [React Documentation](https://reactjs.org/docs/getting-started.html) |
| 107 | +- [FastAPI Documentation](https://fastapi.tiangolo.com/) |
42 | 108 |
|
43 |
| - |
| 109 | +## Troubleshooting |
| 110 | +If you encounter any issues, please check the respective documentation for Tauri, React, and FastAPI. For persistent problems, feel free to open an issue in the project repository. |
0 commit comments