This project is a comprehensive MERN (MongoDB, Express, React, Node.js) application for skin disease detection using a machine learning model. The application allows users to upload images of skin conditions, which are then analyzed by a machine learning model to detect potential skin diseases.
- frontend/ - React frontend application
- backend/ - Node.js/Express backend API
- Model/ - Python Flask API for the ML model
- Node.js (v14 or higher)
- MongoDB
- Python 3.8 or higher
- npm or yarn
-
Navigate to the backend directory:
cd backend -
Install dependencies:
npm install -
Create a
.envfile with the following variables:PORT=5000 MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret EMAIL_USER=your_email_id EMAIL_PASSWORD=your_app_password -
Start the backend server:
npm start
-
For Windows users, you can use the provided batch file to install dependencies:
install_ml_dependencies.batOr manually install dependencies:
cd Model pip install -r python_requirements.txt -
Make sure the model file
skin_disease_model_ISIC_densenet.h5is in the Model folder -
Start the Flask server:
cd Model python app.py
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install -
Create a
.envfile with:REACT_APP_BACKEND_URL=http://localhost:5000/api -
Start the frontend development server:
npm start
For Windows users, you can use the provided batch file to start both the backend and ML model servers:
start_servers.bat
- User authentication (patient and doctor roles)
- Upload skin images for disease detection
- View detection history
- Find and book appointments with dermatologists
- Doctor dashboard to manage appointments
- Patient profiles and medical history
The machine learning model uses a MobileNetV2 architecture to classify skin diseases into the following categories:
- Actinic keratosis
- Atopic Dermatitis
- Benign keratosis
- Dermatofibroma
- Melanocytic nevus
- Melanoma
- Squamous cell carcinoma
- Tinea Ringworm Candidiasis
- Vascular lesion
Note: The current implementation uses a pre-trained model for demonstration purposes. In a production environment, you would fine-tune this model on a skin disease dataset for better accuracy.
- Frontend: React, Redux, Tailwind CSS
- Backend: Node.js, Express, MongoDB
- ML Model: TensorFlow, Flask, OpenCV
- Authentication: JWT
- Image Storage: Cloudinary
This project is licensed under the MIT License.
This guide explains how the ML model has been integrated into the MERN application for skin disease detection.
-
Created a New ML Model
- Used a pre-trained MobileNetV2 model from TensorFlow
- Implemented a Flask API to serve predictions
- Added proper error handling and logging
-
Updated Backend Integration
- Modified the detectionHistoryController.js to communicate with the ML model API
- Added confidence score handling
- Updated the DetectionHistory model to store confidence scores
-
Enhanced Frontend Display
- Updated Dashboard.jsx to display confidence scores
- Improved DetectionHistory.jsx to show confidence information
- Enhanced the UI for better user experience
Run the provided batch file:
install_ml_dependencies.bat
Or manually install dependencies:
cd Model
pip install -r python_requirements.txt
cd Model
python app.py
cd backend
npm start
cd frontend
npm start
Alternatively, you can use the provided batch file to start both the backend and ML model servers:
start_servers.bat
You can test the ML model API directly using the provided test script:
cd Model
python test_model.py test_image.jpg
- When a user uploads an image on the frontend, it's sent to the backend's
/detection-history/uploadendpoint - The backend uploads the image to Cloudinary for storage
- The backend then sends the image to the ML model's API at
http://localhost:7000/predict - The ML model processes the image and returns a prediction with confidence score
- The backend saves the prediction and confidence to the database and returns it to the frontend
- The frontend displays the prediction and confidence to the user
- The current ML model implementation uses a pre-trained model for demonstration purposes
- In a production environment, you would fine-tune this model on a skin disease dataset for better accuracy
- The confidence scores are currently simulated for demonstration purposes
If you encounter any issues:
- Make sure all dependencies are installed correctly
- Check that the ML model server is running on port 7000
- Verify that the backend server is running on port 5000
- Check the console logs for any error messages
- Make sure the image format is supported (JPG, PNG, JPEG)
- Train the model on a real skin disease dataset for better accuracy
- Implement model versioning and tracking
- Add more detailed disease information and treatment recommendations
- Implement a caching mechanism for faster predictions
- Add support for multiple image uploads and batch processing