|
Download README.md from CernovaAI/CANet-v1.1: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/CernovaAI/CANet-v1.1/resolve/main/README.md
- Command line
-
hf download hf://CernovaAI/CANet-v1.1/README.md
-
curl -L -o README.md https://huggingface.co/CernovaAI/CANet-v1.1/resolve/main/README.md
1.96 kB
| license: mit | |
| language: | |
| - en | |
| metrics: | |
| - accuracy | |
| pipeline_tag: image-classification | |
| ## ๐ 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 | |
| ```python | |
| model.fit(train_generator, validation_data=validation_generator, epochs=10) | |
| ``` | |
| After training, the model is saved as: | |
| ```python | |
| model.save("image_classifier.h5") | |
| ``` | |
| --- | |
| ## ๐ฎ Prediction Example | |
| ```python | |
| 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` |