nhellyercreek commited on
Commit
9067441
·
verified ·
1 Parent(s): b09427f

Upload model card

Browse files
Files changed (1) hide show
  1. README.md +8 -40
README.md CHANGED
@@ -6,28 +6,18 @@ tags:
6
  - cipher
7
  - moon-cipher
8
  - pytorch
9
- - crnn
10
  - cnn
 
11
  ---
12
 
13
- # Moon Cipher Detector
14
 
15
- Deep learning models for detecting and decoding **moon cipher** glyphs from images (A–Z plus `~`).
16
-
17
- ## Model variants
18
-
19
- | File | Description |
20
- |------|-------------|
21
- | `best_end_to_end.pth` | End-to-end CRNN: full image → decoded text (recommended for full-page decoding). |
22
- | `best_classifier.pth` | CNN classifier for single glyphs (used with a separate detector in two-stage decoding). |
23
-
24
- Use **end-to-end** for full image decoding; use **classifier** if you already have cropped glyphs or use the two-stage pipeline (detect then classify).
25
 
26
  ## Model metadata
27
 
28
  | Model | Format | Size | Params | Tensor type |
29
  |-------|--------|------|--------|--------------|
30
- | End-to-end (`best_end_to_end.pth`) | PyTorch .pth (state_dict) | 30.0 MB | 7,856,348 params | F32 |
31
  | Classifier (`best_classifier.pth`) | PyTorch .pth (state_dict) | 51.98 MB | 13,616,347 params | F32 |
32
 
33
  Weights are saved as **PyTorch state dict** (`.pth`), not Safetensors. Load with `torch.load(..., weights_only=True)`.
@@ -45,10 +35,9 @@ pip install torch torchvision huggingface_hub
45
  ```python
46
  from huggingface_hub import hf_hub_download
47
 
48
- # End-to-end model (full image → text)
49
  model_path = hf_hub_download(
50
  repo_id="nhellyercreek/moon-cipher-detector",
51
- filename="best_end_to_end.pth"
52
  )
53
  mappings_path = hf_hub_download(
54
  repo_id="nhellyercreek/moon-cipher-detector",
@@ -56,35 +45,14 @@ mappings_path = hf_hub_download(
56
  )
57
  ```
58
 
59
- ### 3. Load and decode (end-to-end)
60
-
61
- Use the same architecture as in this repo’s `models/end_to_end_decoder.py`:
62
-
63
- ```python
64
- import torch
65
- import json
66
- from pathlib import Path
67
-
68
- # Add the Moon-Cipher-Detector repo to path, then:
69
- # from models.end_to_end_decoder import EndToEndMoonCipherDecoder
70
-
71
- # decoder = EndToEndMoonCipherDecoder(
72
- # model_path=model_path,
73
- # model_type="crnn",
74
- # mappings_path=mappings_path,
75
- # device="cuda" if torch.cuda.is_available() else "cpu"
76
- # )
77
- # result = decoder.decode_with_confidence(your_grayscale_image)
78
- # print(result["text"])
79
- ```
80
 
81
- For the **classifier**, use `models/moon_classifier.MoonClassifier` and load `best_classifier.pth`; see the project’s `models/sequence_decoder.py` and `backend/main.py` for the full pipeline.
82
 
83
  ## Config
84
 
85
  - **Classes**: 27 (A–Z + `~`)
86
- - **End-to-end**: Deep CRNN (CNN + bidirectional LSTM, CTC).
87
- - **Classifier**: Custom CNN, 128×128 input, 27 classes.
88
  - **Weight format**: PyTorch `.pth` (state_dict), **tensor type**: F32.
89
 
90
- See `config.json` in this repo for machine-readable settings (params, size, format).
 
6
  - cipher
7
  - moon-cipher
8
  - pytorch
 
9
  - cnn
10
+ - image-classification
11
  ---
12
 
13
+ # Moon Cipher Detector (Classifier)
14
 
15
+ CNN classifier for **moon cipher** glyph recognition: 27 classes (A–Z plus `~`). Input: 128×128 grayscale glyph crop. Use with a detector for full image decoding.
 
 
 
 
 
 
 
 
 
16
 
17
  ## Model metadata
18
 
19
  | Model | Format | Size | Params | Tensor type |
20
  |-------|--------|------|--------|--------------|
 
21
  | Classifier (`best_classifier.pth`) | PyTorch .pth (state_dict) | 51.98 MB | 13,616,347 params | F32 |
22
 
23
  Weights are saved as **PyTorch state dict** (`.pth`), not Safetensors. Load with `torch.load(..., weights_only=True)`.
 
35
  ```python
36
  from huggingface_hub import hf_hub_download
37
 
 
38
  model_path = hf_hub_download(
39
  repo_id="nhellyercreek/moon-cipher-detector",
40
+ filename="best_classifier.pth"
41
  )
42
  mappings_path = hf_hub_download(
43
  repo_id="nhellyercreek/moon-cipher-detector",
 
45
  )
46
  ```
47
 
48
+ ### 3. Load and run
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ Use `MoonClassifier` from the Moon-Cipher-Detector repo (`models/moon_classifier.py`). Load with `torch.load(model_path, weights_only=True)` and pass 128×128 grayscale glyph crops.
51
 
52
  ## Config
53
 
54
  - **Classes**: 27 (A–Z + `~`)
55
+ - **Architecture**: Custom CNN (MoonClassifier), 128×128 input.
 
56
  - **Weight format**: PyTorch `.pth` (state_dict), **tensor type**: F32.
57
 
58
+ See `config.json` for machine-readable settings (params, size, format).