# alex000kim/nsfw_data_scraper architecture

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

- Interactive diagram: https://gitdiagram.com/alex000kim/nsfw_data_scraper
- Repository: https://github.com/alex000kim/nsfw_data_scraper

## Overview

NSFW Data Scraper collects labeled images for five categories, prepares train and test sets, and supports CNN training. The documented workflow is URL collection, image downloading, dataset cleanup and assembly, test splitting, then notebook-based model training. Optional downloads add drawing and neutral images from external datasets. No source excerpts were provided, so relationships below rely on README documentation; implementation details beyond that are omitted.

Main entry points: [`scripts/1_get_urls_.sh`](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/1_get_urls_.sh) (Harvest image URLs), [`raw_data`](https://github.com/alex000kim/nsfw_data_scraper/tree/main/raw_data) (Raw URL lists), [`scripts/2_download_from_urls_.sh`](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/2_download_from_urls_.sh) (Download images), [`scripts/3_optional_download_drawings_.sh`](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/3_optional_download_drawings_.sh) (Download drawings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Image collection"]
  node_url_sources["Category URL lists"]
  node_url_harvester["Harvest image URLs<br/>[1_get_urls_.sh]"]
  node_raw_urls["Raw URL lists"]
  node_image_downloader["Download images"]
  node_raw_images["Collected images"]
  node_drawing_downloader["Download drawings"]
  node_neutral_downloader["Download neutral images"]
end

subgraph group_preparation["Dataset preparation"]
  node_train_builder["Build training set<br/>[5_create_train_.sh]"]
  node_train_set[("Training images<br/>[5_create_train_.sh]")]
  node_test_splitter["Create test split<br/>[6_create_test_.sh]"]
  node_test_set[("Test images<br/>[6_create_test_.sh]")]
end

subgraph group_training["Model training"]
  node_model_notebook["Train CNN classifier<br/>[train_model.ipynb]"]
end

node_user(("Dataset operator"))
node_ripme["Ripme"]
node_danbooru["Danbooru2018"]
node_caltech["Caltech256"]
node_fastai["fastai"]

node_user -->|"runs collection"| node_url_harvester
node_url_sources -->|"provides URLs"| node_url_harvester
node_url_harvester -->|"uses"| node_ripme
node_url_harvester -->|"writes URLs"| node_raw_urls
node_raw_urls -->|"supplies URLs"| node_image_downloader
node_image_downloader -->|"downloads images"| node_raw_images
node_user -.->|"may run"| node_drawing_downloader
node_drawing_downloader -->|"downloads from"| node_danbooru
node_user -.->|"may run"| node_neutral_downloader
node_neutral_downloader -->|"downloads from"| node_caltech
node_raw_images -->|"provides images"| node_train_builder
node_train_builder -->|"creates and cleans"| node_train_set
node_train_set -->|"provides images"| node_test_splitter
node_test_splitter -->|"moves random images"| node_test_set
node_user -->|"runs notebook"| node_model_notebook
node_model_notebook -->|"requires"| node_fastai

click node_url_sources "https://github.com/alex000kim/nsfw_data_scraper/tree/main/scripts/source_urls"
click node_url_harvester "https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/1_get_urls_.sh"
click node_raw_urls "https://github.com/alex000kim/nsfw_data_scraper/tree/main/raw_data"
click node_image_downloader "https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/2_download_from_urls_.sh"
click node_raw_images "https://github.com/alex000kim/nsfw_data_scraper/tree/main/raw_data"
click node_drawing_downloader "https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/3_optional_download_drawings_.sh"
click node_neutral_downloader "https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/4_optional_download_neutral_.sh"
click node_train_builder "https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/5_create_train_.sh"
click node_train_set "https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/5_create_train_.sh"
click node_test_splitter "https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/6_create_test_.sh"
click node_test_set "https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/6_create_test_.sh"
click node_model_notebook "https://github.com/alex000kim/nsfw_data_scraper/blob/main/train_model.ipynb"

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_url_sources,node_url_harvester,node_raw_urls,node_image_downloader,node_raw_images,node_drawing_downloader,node_neutral_downloader toneBlue
class node_train_builder,node_train_set,node_test_splitter,node_test_set toneAmber
class node_model_notebook toneMint
class node_user,node_ripme,node_danbooru,node_caltech,node_fastai toneIndigo
```

## Components

### Image collection

- [Category URL lists](https://github.com/alex000kim/nsfw_data_scraper/tree/main/scripts/source_urls): `scripts/source_urls`
- [Harvest image URLs](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/1_get_urls_.sh): `scripts/1_get_urls_.sh`
- [Raw URL lists](https://github.com/alex000kim/nsfw_data_scraper/tree/main/raw_data): `raw_data`
- [Download images](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/2_download_from_urls_.sh): `scripts/2_download_from_urls_.sh`
- [Collected images](https://github.com/alex000kim/nsfw_data_scraper/tree/main/raw_data): `raw_data`
- [Download drawings](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/3_optional_download_drawings_.sh): `scripts/3_optional_download_drawings_.sh`
- [Download neutral images](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/4_optional_download_neutral_.sh): `scripts/4_optional_download_neutral_.sh`

### Dataset preparation

- [Build training set](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/5_create_train_.sh): `scripts/5_create_train_.sh`
- [Training images](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/5_create_train_.sh): `scripts/5_create_train_.sh`
- [Create test split](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/6_create_test_.sh): `scripts/6_create_test_.sh`
- [Test images](https://github.com/alex000kim/nsfw_data_scraper/blob/main/scripts/6_create_test_.sh): `scripts/6_create_test_.sh`

### Model training

- [Train CNN classifier](https://github.com/alex000kim/nsfw_data_scraper/blob/main/train_model.ipynb): `train_model.ipynb`

### Other components

- **Dataset operator**
- **Ripme**
- **Danbooru2018**
- **Caltech256**
- **fastai**

## Connections

- Dataset operator → Harvest image URLs: runs collection (evidence: `README.md`)
- Category URL lists → Harvest image URLs: provides URLs (evidence: `README.md`)
- Harvest image URLs → Ripme: uses (evidence: `README.md`)
- Harvest image URLs → Raw URL lists: writes URLs (evidence: `README.md`)
- Raw URL lists → Download images: supplies URLs (evidence: `README.md`)
- Download images → Collected images: downloads images (evidence: `README.md`)
- Dataset operator → Download drawings: may run (evidence: `README.md`)
- Download drawings → Danbooru2018: downloads from (evidence: `README.md`)
- Dataset operator → Download neutral images: may run (evidence: `README.md`)
- Download neutral images → Caltech256: downloads from (evidence: `README.md`)
- Collected images → Build training set: provides images (evidence: `README.md`)
- Build training set → Training images: creates and cleans (evidence: `README.md`)
- Training images → Create test split: provides images (evidence: `README.md`)
- Create test split → Test images: moves random images (evidence: `README.md`)
- Dataset operator → Train CNN classifier: runs notebook (evidence: `README.md`)
- Train CNN classifier → fastai: requires (evidence: `README.md`)
