This project aims to detect and segment anomalies on wood surfaces using unsupervised deep learning models. It includes a FastAPI-based backend and a React-based frontend. The following instructions will help you set up and run the project locally.
git clone https://github.com/melisguclu/anomaly-detection.git
cd wood-anomaly-detection
Download the pretrained PaDiM model manually from the following Google Drive link:
After downloading, unzip the file and place it into the following directory inside the project:
models/padim/train_wood.pkl
Do not unzip it yet. Further steps will handle that automatically if necessary.
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # For Unix/MacOS
venv\Scripts\activate # For Windows
pip install --upgrade pip
pip install -r backend/requirements.txt
Navigate into the backend folder and start the FastAPI development server:
cd backend
uvicorn main:app --reload
By default, the API will be available at:
http://127.0.0.1:8000
You can view the automatically generated API docs at:
http://127.0.0.1:8000/docs
Navigate to the frontend directory and install the dependencies:
cd ../frontend
npm install
npm run dev
This will start the React development server, typically available at:
http://localhost:5173
Make sure the backend is running simultaneously for the application to function properly.
Ensure the dataset is placed under the following structure:
wood_dataset/
└── wood/
├── train/
│ └── good/
├── test/
│ ├── good/
│ └── defect/
└── ground_truth/
└── defect/
This dataset structure is crucial for training and evaluating the models.
- Ensure all Python and Node dependencies are correctly installed.
- The pretrained model must be manually downloaded and placed into the correct folder.
- Backend and frontend must run concurrently for proper functionality.
For any issues or questions, please open an issue on the GitHub repository or contact the contributors.