# dan11lkaa/neural_network-rusal architecture

> Architecture diagram of the GitHub repository dan11lkaa/neural_network-rusal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dan11lkaa/neural_network-rusal
- Repository: https://github.com/dan11lkaa/neural_network-rusal

## Overview

This is an image-based ore-fragment-size regression workflow: preprocess source images, label and train on processed images, then evaluate a saved model on test images. The sampled preprocessing and training scripts provide implementation detail; test_model.py is represented only at the level documented in the README, so its internal call structure is omitted.

Main entry points: [`train_model.py`](https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py) (Training and validation), [`processing_img.py`](https://github.com/dan11lkaa/neural_network-rusal/blob/main/processing_img.py) (Image preprocessing), [`test_model.py`](https://github.com/dan11lkaa/neural_network-rusal/blob/main/test_model.py) (Model testing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_preparation["Image preparation"]
  node_preprocess["Image preprocessing<br/>[processing_img.py]"]
  node_source_images["Source images"]
  node_processed_images["Processed images"]
  node_enhancement["Contrast enhancement<br/>[processing_img.py]"]
  node_contours["Contour masking<br/>[processing_img.py]"]
end

subgraph group_learning["Model training"]
  node_label_setup["Label preparation<br/>[train_model.py]"]
  node_labels["Regression labels"]
  node_data_prep["Dataset preparation<br/>[train_model.py]"]
  node_augmentation["Image transforms<br/>[train_model.py]"]
  node_model["ResNet regression model<br/>[train_model.py]"]
  node_trainer["Training and validation<br/>[train_model.py]"]
  node_metrics["MSE and R² metrics<br/>[train_model.py]"]
  node_training_plots["Training plots<br/>[train_model.py]"]
  node_saved_model["Saved model weights"]
end

subgraph group_evaluation["Model evaluation"]
  node_test_data["Test images"]
  node_tester["Model testing<br/>[test_model.py]"]
  node_predictions["Predictions and trends<br/>[test_model.py]"]
end

node_user(("Project user"))

node_user -->|"runs"| node_preprocess
node_preprocess -->|"reads"| node_source_images
node_preprocess -->|"applies"| node_enhancement
node_preprocess -->|"applies"| node_contours
node_preprocess -->|"writes"| node_processed_images
node_user -->|"runs"| node_label_setup
node_label_setup -->|"lists images"| node_processed_images
node_label_setup -->|"creates or loads"| node_labels
node_data_prep -->|"loads"| node_processed_images
node_data_prep -->|"reads"| node_labels
node_data_prep -->|"transforms"| node_augmentation
node_trainer -->|"trains"| node_model
node_trainer -->|"uses loaders"| node_data_prep
node_trainer -->|"computes"| node_metrics
node_trainer -->|"saves weights"| node_saved_model
node_trainer -->|"plots metrics"| node_training_plots
node_user -->|"runs"| node_tester
node_tester -->|"loads"| node_saved_model
node_tester -->|"evaluates"| node_test_data
node_tester -->|"visualizes"| node_predictions

click node_preprocess "https://github.com/dan11lkaa/neural_network-rusal/blob/main/processing_img.py"
click node_enhancement "https://github.com/dan11lkaa/neural_network-rusal/blob/main/processing_img.py"
click node_contours "https://github.com/dan11lkaa/neural_network-rusal/blob/main/processing_img.py"
click node_label_setup "https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py"
click node_data_prep "https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py"
click node_augmentation "https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py"
click node_model "https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py"
click node_trainer "https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py"
click node_metrics "https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py"
click node_training_plots "https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py"
click node_tester "https://github.com/dan11lkaa/neural_network-rusal/blob/main/test_model.py"
click node_predictions "https://github.com/dan11lkaa/neural_network-rusal/blob/main/test_model.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_preprocess,node_source_images,node_processed_images,node_enhancement,node_contours,node_user toneBlue
class node_label_setup,node_labels,node_data_prep,node_augmentation,node_model,node_trainer,node_metrics,node_training_plots,node_saved_model toneAmber
class node_test_data,node_tester,node_predictions toneMint
```

## Components

### Image preparation

- [Image preprocessing](https://github.com/dan11lkaa/neural_network-rusal/blob/main/processing_img.py): `processing_img.py`
- **Source images**
- **Processed images**
- [Contrast enhancement](https://github.com/dan11lkaa/neural_network-rusal/blob/main/processing_img.py): `processing_img.py`
- [Contour masking](https://github.com/dan11lkaa/neural_network-rusal/blob/main/processing_img.py): `processing_img.py`

### Model training

- [Label preparation](https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py): `train_model.py`
- **Regression labels**
- [Dataset preparation](https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py): `train_model.py`
- [Image transforms](https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py): `train_model.py`
- [ResNet regression model](https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py): `train_model.py`
- [Training and validation](https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py): `train_model.py`
- [MSE and R² metrics](https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py): `train_model.py`
- [Training plots](https://github.com/dan11lkaa/neural_network-rusal/blob/main/train_model.py): `train_model.py`
- **Saved model weights**

### Model evaluation

- **Test images**
- [Model testing](https://github.com/dan11lkaa/neural_network-rusal/blob/main/test_model.py): `test_model.py`
- [Predictions and trends](https://github.com/dan11lkaa/neural_network-rusal/blob/main/test_model.py): `test_model.py`

### Other components

- **Project user**

## Connections

- Project user → Image preprocessing: runs (evidence: `README.md`)
- Image preprocessing → Source images: reads (evidence: `processing_img.py`)
- Image preprocessing → Contrast enhancement: applies (evidence: `processing_img.py`)
- Image preprocessing → Contour masking: applies (evidence: `processing_img.py`)
- Image preprocessing → Processed images: writes (evidence: `processing_img.py`)
- Project user → Label preparation: runs (evidence: `README.md`)
- Label preparation → Processed images: lists images (evidence: `train_model.py`)
- Label preparation → Regression labels: creates or loads (evidence: `train_model.py`)
- Dataset preparation → Processed images: loads (evidence: `train_model.py`)
- Dataset preparation → Regression labels: reads (evidence: `train_model.py`)
- Dataset preparation → Image transforms: transforms (evidence: `train_model.py`)
- Training and validation → ResNet regression model: trains (evidence: `train_model.py`)
- Training and validation → Dataset preparation: uses loaders (evidence: `train_model.py`)
- Training and validation → MSE and R² metrics: computes (evidence: `train_model.py`)
- Training and validation → Saved model weights: saves weights (evidence: `train_model.py`)
- Training and validation → Training plots: plots metrics (evidence: `train_model.py`)
- Project user → Model testing: runs (evidence: `README.md`)
- Model testing → Saved model weights: loads (evidence: `README.md`)
- Model testing → Test images: evaluates (evidence: `README.md`)
- Model testing → Predictions and trends: visualizes (evidence: `README.md`)
