File size: 1,457 Bytes
05ab0ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
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)
```

---