|
|
--- |
|
|
license: mit |
|
|
--- |
|
|
|
|
|
# π§ Multi-Cancer Image Classification |
|
|
|
|
|
This project aims to classify different types of cancer images using a **deep learning Convolutional Neural Network (CNN)**. The model is built with **TensorFlow/Keras**. |
|
|
|
|
|
## π Project Structure |
|
|
|
|
|
* Data preprocessing is done with `ImageDataGenerator` (normalization and train/validation split). |
|
|
* The CNN model is created with **Conv2D**, **MaxPooling2D**, and **Dense** layers. |
|
|
* After training, the model is saved as `.h5`. |
|
|
* The function `gercek_deger()` allows testing predictions on a single image. |
|
|
|
|
|
## βοΈ Dependencies |
|
|
|
|
|
* **TensorFlow / Keras** |
|
|
* **NumPy** |
|
|
* **Matplotlib** |
|
|
|
|
|
## π Model Architecture |
|
|
|
|
|
1. **Conv2D + MaxPooling2D** β Feature extraction from images |
|
|
2. **Conv2D + MaxPooling2D** |
|
|
3. **Conv2D + MaxPooling2D** |
|
|
4. **Flatten** β Convert data into a vector |
|
|
5. **Dense (512, ReLU)** β Fully connected layer |
|
|
6. **Dense (Softmax)** β Output layer with class probabilities |
|
|
|
|
|
## ποΈ Training |
|
|
|
|
|
* Input image size: **150x150** |
|
|
* Batch size: **32** |
|
|
* Optimizer: **Adam** |
|
|
* Loss: **Categorical Crossentropy** |
|
|
* Metrics: **Accuracy** |
|
|
* Epochs: **10** |
|
|
|
|
|
## π Usage |
|
|
|
|
|
### Train the model |
|
|
|
|
|
```python |
|
|
model.fit(train_generator, validation_data=validation_generator, epochs=10) |
|
|
``` |
|
|
|
|
|
### Save the model |
|
|
|
|
|
```python |
|
|
model.save("image_classifier.h5") |
|
|
``` |
|
|
|
|
|
### Predict on a new image |
|
|
|
|
|
```python |
|
|
gercek_deger("test_image.jpg", model, train_generator.class_indices) |
|
|
``` |
|
|
|
|
|
--- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|