๐Ÿ“‚ Project Structure

.
โ”œโ”€โ”€ image_classifier.h5     # Trained model
โ”œโ”€โ”€ main.py                 # Training & prediction script
โ””โ”€โ”€ README.md               # Project description

โš™๏ธ Technologies Used

  • Python 3.10+
  • TensorFlow / Keras
  • NumPy
  • Matplotlib

๐Ÿ“Š Dataset

The dataset is from Kaggle Multi-Cancer Dataset:

/kaggle/input/multi-cancer/Multi Cancer/Multi Cancer/Breast Cancer

Images are split into 90% training and 10% validation using ImageDataGenerator.


๐Ÿ—๏ธ Model Architecture

  • Conv2D (32 filters, 3x3, ReLU)
  • MaxPooling2D (2x2)
  • Conv2D (64 filters, 3x3, ReLU)
  • MaxPooling2D (2x2)
  • Conv2D (128 filters, 3x3, ReLU)
  • MaxPooling2D (2x2)
  • Flatten
  • Dense (512, ReLU)
  • Dense (Softmax output, # of classes)

Optimizer: Adam Loss: Categorical Crossentropy Metric: Accuracy


๐Ÿš€ Training

model.fit(train_generator, validation_data=validation_generator, epochs=10)

After training, the model is saved as:

model.save("image_classifier.h5")

๐Ÿ”ฎ Prediction Example

def guess(image_path, model, class_indices):
    img = load_img(image_path, target_size=(150, 150))
    img_array = img_to_array(img) / 255.0
    img_array = np.expand_dims(img_array, axis=0)

    prediction = model.predict(img_array)
    predicted_class = np.argmax(prediction)
    class_labels = {v: k for k, v in class_indices.items()}
    predicted_label = class_labels[predicted_class]

    plt.imshow(img)
    plt.title(f"Model guess: {predicted_label}")
    plt.axis("off")
    plt.show()

โœ… Results

  • Trains a CNN model for breast cancer image classification
  • Provides a simple guess() function to visualize predictions
  • Model is reusable via image_classifier.h5
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support