SkinLens is a web application designed to assist in the diagnosis of skin lesions. Users can upload high-quality images of skin lesions, which are then classified using a convolutional neural network. This tool aims to provide an interactive and accurate diagnosis suggestion to help in early detection and treatment.
skin-lens/
│── .gitignore # Git ignore file
│── LICENSE # License file
│── README.md # Project documentation
│── api/ # Backend server for model inference
│ ├── main.py # FastAPI entry point
│ ├── readme.md # API specific documentation
│ ├── requirements.txt # Backend dependencies
│ ├── models/ # Model (trained weights, model loading)
│ │ ├── __init__.py
│ │ ├── checkpoint_epoch__effnet_b1_35.pth
│ │ ├── cnn_model.py
│ ├── routes/ # API routes for handling requests
│ │ ├── __init__.py
│ │ ├── classify_routes.py
│ ├── utils/ # Utility functions (preprocessing)
│ ├── __init__.py
│ ├── image_processing.py
│── frontend/ # Frontend application
│ ├── .babelrc # Babel configuration
│ ├── package.json # Frontend dependencies
│ ├── webpack.config.js # Webpack configuration
│ ├── public/ # Static assets
│ ├── src/ # React components
│ ├── App.js # Main frontend app
│ ├── index.js # Entry point
│ ├── index.css # Global styles
│ ├── components/ # UI components
│ ├── pages/ # React pages
│ ├── Home.jsx
│ ├── LandingPage.jsx
│── notebooks/ # Jupyter Notebooks for model training
│ ├── resnet18_transfer_isic2019.ipynbThe SkinLens API is built using FastAPI and serves a Convolutional Neural Network (CNN) model for image classification. The model used is EfficientNet-B1, which has been trained on the ISIC 2019 dataset for skin lesion classification (multiclass classification, 8 classes). The API provides endpoints for image classification and is designed to handle image uploads, preprocess the images, and return classification results.
- Image Upload: Users upload an image of a skin lesion through the frontend.
- Image Preprocessing: The uploaded image is preprocessed to match the input requirements of the CNN model.
- Model Inference: The preprocessed image is passed through the EfficientNet-B1 model to obtain classification results.
- Result: The classification results, including the predicted class and confidence score, are returned.
- GET /: Returns a welcome message.
- POST /api/classify: Accepts an image file and returns the classification result (class and confidence score).
-
Create a Virtual Environment
First, create a virtual environment to isolate the project's dependencies. You can use
venvfor this purpose.python3 -m venv venv source venv/bin/activatepython -m venv venv venv\Scripts\activate
-
Install Dependencies
With the virtual environment activated, install the required dependencies using the
requirements.txtfile.pip install -r api/requirements.txt
-
Run the FastAPI Application
Use
uvicornto run the FastAPI application.uvicorn api.main:app --reload
The server will start, and you can access the API at http://127.0.0.1:8000/api/classify.
-
Navigate to the Frontend Directory
cd frontend -
Install Project Dependencies
npm install
-
Run the Webpack Server in Development Mode
npm run dev
The frontend application will start, and you can access it at http://localhost:3000.
- App.js: Main application component that sets up routing.
- Home.jsx: Page component for the skin lesion classifier.
- LandingPage.jsx: Landing page component.
- Button.js: UI component for buttons.
- Card.js: UI component for cards.
- CardContent.js: UI component for card content.
- Tailwind CSS: Used for utility-first CSS styling.
- Custom Styles: Defined in
src/index.css.
- Webpack: Module bundler for the frontend.
- Babel: JavaScript compiler for using the latest JavaScript features.
- PostCSS: Tool for transforming CSS with JavaScript plugins.
This project is licensed under the MIT License - see the LICENSE file for details.
