Ứng dụng web phân tích và phát hiện bệnh ngoài da sử dụng Deep Learning với mô hình Vision Transformer (ViT).
Dự án này cung cấp một hệ thống hoàn chỉnh để phát hiện và phân loại các bệnh ngoài da thông qua hình ảnh, sử dụng công nghệ AI tiên tiến.
Phát hiện bệnh ngoài da từ hình ảnh tải lên Độ chính xác cao với mô hình Vision Transformer Xác thực người dùng với JWT Lịch sử dự đoán cho mỗi người dùng Giao diện thân thiện với Vue.js và Tailwind CSS API Documentation tự động với FastAPI
- Frontend: Vue 3, Vue Router, Pinia, Vite, Tailwind CSS
- Backend: Node.js, Express.js, Sequelize ORM, JWT
- ML API: Python, FastAPI, PyTorch, Hugging Face Transformers
- Database: MySQL
- AI Model: Vision Transformer (ViT)
- Node.js >= 16.x
- Python >= 3.8
- MySQL >= 8.0
- npm hoặc yarn
- Git
node --version
python --version
mysql --versiongit clone https://github.com/Nguyenthanhluu04/skin_disease.git
cd skin_diseaseCREATE DATABASE skin_disease_db;Tạo file .env trong thư mục backend/:
PORT=5000
NODE_ENV=development
# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_NAME=skin_disease_db
DB_USER=root
DB_PASSWORD=your_mysql_password
# JWT Secret
JWT_SECRET=your_secret_key_here
# Python API URL
PYTHON_API_URL=http://localhost:8000cd frontend
npm installcd backend
npm installcd ml-api
python -m venv venv# Windows
venv\Scripts\activatepip install -r requirements.txtTạo file .env trong thư mục ml-api/:
API_HOST=0.0.0.0
API_PORT=8000
LOG_LEVEL=INFO
MODEL_NAME=Anwarkh1/Skin_Cancer-Image_ClassificationModel sẽ tự động được tải về từ Hugging Face khi chạy ML API lần đầu tiên.
Mở 3 terminal riêng biệt:
cd backend
npm run devcd ml-api
venv\Scripts\activate
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd frontend
npm run dev# Frontend
npm run dev:frontend
# Backend
npm run dev:backend
# ML API
npm run dev:mlSau khi chạy tất cả services:
- Frontend: http://localhost:3000
- Backend API: https://skinbe.onrender.com
- ML API: http://localhost:8000
- ML API Docs: http://localhost:8000/docs
Predict_Skin_Diseases/
├── frontend/ # Vue.js Application
│ ├── src/
│ │ ├── components/ # Reusable components
│ │ ├── views/ # Page components
│ │ ├── router/ # Route configuration
│ │ ├── stores/ # Pinia stores
│ │ └── services/ # API services
│ └── package.json
│
├── backend/ # Express.js API
│ ├── src/
│ │ ├── config/ # Configuration files
│ │ ├── controllers/ # Request handlers
│ │ ├── middleware/ # Custom middleware
│ │ ├── models/ # Sequelize models
│ │ ├── routes/ # API routes
│ │ └── services/ # Business logic
│ ├── uploads/ # Uploaded images
│ └── server.js
│
├── ml-api/ # FastAPI ML Service
│ ├── app/
│ │ ├── main.py # FastAPI application
│ │ ├── model.py # ML model wrapper
│ │ └── utils.py # Utility functions
│ ├── models/ # Downloaded AI models
│ └── requirements.txt
│
├── package.json # Root package
└── README.md # This file
POST /api/users/register- Đăng ký tài khoảnPOST /api/users/login- Đăng nhậpGET /api/users/profile- Thông tin người dùng (auth required)
POST /api/predictions/predict- Dự đoán bệnh (auth required)GET /api/predictions/history- Lịch sử dự đoán (auth required)GET /api/predictions/:id- Chi tiết dự đoán (auth required)
GET /- API informationGET /health- Health checkPOST /predict- Predict skin disease from imageGET /classes- Get all disease classesGET /docs- Interactive API documentation
# Health check
curl https://skinbe.onrender.com/health# Health check
curl http://localhost:8000/health
# Hoặc truy cập Swagger UI
# http://localhost:8000/docs- Đăng ký tài khoản tại
/register - Đăng nhập với email và password
- Tải lên hình ảnh da cần phân tích tại trang
/detection - Xem kết quả phân tích với độ tin cậy
- Xem lịch sử các lần dự đoán tại
/history
cd frontend
npm run dev # Development server
npm run build # Production build
npm run preview # Preview production buildcd backend
npm run dev # Development with nodemon
npm start # Production modecd ml-api
venv\Scripts\activate
uvicorn app.main:app --reload # Auto-reload on changes- id (Primary Key)
- email (Unique)
- password (Hashed)
- fullName
- createdAt, updatedAt
- id (Primary Key)
- userId (Foreign Key)
- imagePath
- predictedClass
- confidence
- allPredictions (JSON)
- diseaseInfo (JSON)
- createdAt
- Model: Vision Transformer (ViT)
- Source: Hugging Face -
Anwarkh1/Skin_Cancer-Image_Classification - Input: 224x224 RGB images
- Framework: PyTorch + Transformers
- Task: Multi-class skin disease classification
- JWT Authentication
- Password hashing với bcrypt
- CORS protection
- Rate limiting
- Input validation
- Secure file upload
PORT=5000
NODE_ENV=development
DB_HOST=localhost
DB_PORT=3306
DB_NAME=skin_disease_db
DB_USER=root
DB_PASSWORD=your_password
JWT_SECRET=your_secret
PYTHON_API_URL=http://localhost:8000API_HOST=0.0.0.0
API_PORT=8000
LOG_LEVEL=INFO
MODEL_NAME=Anwarkh1/Skin_Cancer-Image_Classification- Kiểm tra MySQL đã chạy chưa
- Xác nhận thông tin đăng nhập trong
.env - Đảm bảo database đã được tạo
# Tìm process đang dùng port
netstat -ano | findstr :3000
netstat -ano | findstr :5000
netstat -ano | findstr :8000
# Kill process (thay PID bằng số process ID)
taskkill /PID <PID> /F# Xóa và tạo lại venv
cd ml-api
Remove-Item -Recurse -Force venv
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt- Kiểm tra kết nối internet
- Model sẽ tự động tải về lần đầu chạy (có thể mất vài phút)
- Nếu lỗi, xóa folder
ml-api/modelsvà chạy lại
- Vue.js Documentation
- Express.js Guide
- FastAPI Documentation
- PyTorch Documentation
- Hugging Face Transformers
- Vision Transformer Paper
- Nguyễn Thanh Lưu - GitHub
MIT License - Xem file LICENSE để biết thêm chi tiết.
- Hugging Face cho pre-trained Vision Transformer model
- Anwarkh1 cho Skin Cancer Classification model
- Vue.js, Express.js và FastAPI communities