MilanMagik commited on
Commit
2cbe551
·
verified ·
1 Parent(s): 4690c5e

Add deployment model card

Browse files
Files changed (1) hide show
  1. README.md +152 -0
README.md ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AstroColorProcess
2
+
3
+ 面向天文摄影后期处理的 Python/PyTorch 示例项目。目前包含 AI 星图降噪、AI 去星,
4
+ 以及背景提取、星点反卷积和星点缩小等实验模块。
5
+
6
+ - GitHub:<https://github.com/CHMimilanlan/AstroColorProcess>
7
+ - 模型权重:<https://huggingface.co/MilanMagik/AstroStarDetect>
8
+
9
+ ## AI 模块
10
+
11
+ | 目录 | 功能 | 推理权重 | 大小(约) |
12
+ | --- | --- | --- | ---: |
13
+ | `StarDenoise` | 星图/深空图像降噪 | `deep_denoise_cnn_AI3_6.pth` | 33.8 MB |
14
+ | `StarNetPyTorch` | RGB 或灰度天文图像去星 | `weights_G_RGB.pth`、`weights_G_Greyscale.pth` | 各 208 MB |
15
+
16
+ 权重没有提交到 GitHub,请从 Hugging Face 下载。仓库内的测试图和输出仅用于演示,
17
+ 实际部署时可以只保留代码、依赖和所需权重。
18
+
19
+ ## 1. 环境安装
20
+
21
+ 本项目在 Windows 的 Conda `study` 环境中验证:
22
+
23
+ ```powershell
24
+ conda activate study
25
+ cd D:\Workman\MyProject\ImageStack\AstroColorProcess
26
+ python -m pip install -r requirements.txt
27
+ ```
28
+
29
+ 如需 NVIDIA GPU,请根据本机 CUDA 版本先从
30
+ [PyTorch 官方安装页面](https://pytorch.org/get-started/locally/)安装对应的 CUDA 版
31
+ PyTorch,再安装其余依赖。CPU 也能运行,但处理高分辨率图像会慢很多。
32
+
33
+ ## 2. 下载模型权重
34
+
35
+ 推荐使用仓库自带脚本。它会把权重放到两个程序默认读取的位置:
36
+
37
+ ```powershell
38
+ conda activate study
39
+ python download_models.py
40
+ ```
41
+
42
+ 也可以只下载其中一类模型:
43
+
44
+ ```powershell
45
+ python download_models.py --only denoise
46
+ python download_models.py --only starnet
47
+ ```
48
+
49
+ 等价的 Hugging Face CLI 命令:
50
+
51
+ ```powershell
52
+ hf download MilanMagik/AstroStarDetect `
53
+ StarDenoise/models/deep_denoise_cnn_AI3_6.pth `
54
+ StarNetPyTorch/models/weights_G_RGB.pth `
55
+ StarNetPyTorch/models/weights_G_Greyscale.pth `
56
+ --local-dir .
57
+ ```
58
+
59
+ 下载后目录应为:
60
+
61
+ ```text
62
+ AstroColorProcess/
63
+ ├── StarDenoise/models/deep_denoise_cnn_AI3_6.pth
64
+ └── StarNetPyTorch/models/
65
+ ├── weights_G_RGB.pth
66
+ └── weights_G_Greyscale.pth
67
+ ```
68
+
69
+ 权重 SHA-256:
70
+
71
+ | 文件 | SHA-256 |
72
+ | --- | --- |
73
+ | `deep_denoise_cnn_AI3_6.pth` | `f860e234dc6a3ab1acacbea399c235179c86cb8b287f2ab9010bc18c8af08671` |
74
+ | `weights_G_RGB.pth` | `e69bef14cfe0363f2df79752cae7deca5f8ea3e73685e58998a39409ce9a8a46` |
75
+ | `weights_G_Greyscale.pth` | `ed4df34a9f655274c9e985a3d1742e649bb0bb3c21ec63f20f42a593e002dca4` |
76
+
77
+ ## 3. 星图降噪
78
+
79
+ 支持常见位图、TIFF 和 FITS。默认会自动选择 CUDA 或 CPU,并使用分块推理降低显存占用:
80
+
81
+ ```powershell
82
+ cd StarDenoise
83
+ python denoise.py input.tif output.tif --device auto --strength 0.85
84
+ ```
85
+
86
+ 密集星场建议从较低强度开始,避免把真实的小星点误判为噪声:
87
+
88
+ ```powershell
89
+ python denoise.py input.tif output.tif --device auto --strength 0.30 --color-strength 0.25
90
+ ```
91
+
92
+ 常用参数:
93
+
94
+ - `--strength`:亮度降噪强度,通常为 `0.25–0.90`。
95
+ - `--color-strength`:色彩降噪强度。
96
+ - `--tile-size` / `--overlap`:分块尺寸和重叠宽度。
97
+ - `--linear-stretch never`:对已经拉伸的普通图片关闭线性拉伸。
98
+
99
+ 更完整的模型说明、格式支持和训练建议参见
100
+ [`StarDenoise/README.md`](StarDenoise/README.md)。1080P 实测记录见
101
+ [`StarDenoise/README_1080P.md`](StarDenoise/README_1080P.md)。
102
+
103
+ ## 4. StarNet PyTorch 去星
104
+
105
+ 推荐使用 TIFF 输入。RGB 图像默认加载 `weights_G_RGB.pth`:
106
+
107
+ ```powershell
108
+ cd StarNetPyTorch
109
+ python starnet_v1_pytorch_transform.py input.tif output_starless.tif `
110
+ --mode RGB --device cuda
111
+ ```
112
+
113
+ 灰度图像:
114
+
115
+ ```powershell
116
+ python starnet_v1_pytorch_transform.py input.tif output_starless.tif `
117
+ --mode Greyscale --device cpu
118
+ ```
119
+
120
+ 不传 `--device` 时程序会自动选择 CUDA 或 CPU。显存紧张时可减小窗口或增加步长,
121
+ 例如 `--window-size 256 --stride 128`;`window-size` 必须能被 256 整除。
122
+
123
+ ## 5. 离线部署
124
+
125
+ 在有网络的机器上先执行:
126
+
127
+ ```powershell
128
+ python download_models.py
129
+ python -m pip download -r requirements.txt -d wheels
130
+ ```
131
+
132
+ 把整个项目和 `wheels` 目录复制到离线机器,然后执行:
133
+
134
+ ```powershell
135
+ python -m pip install --no-index --find-links wheels -r requirements.txt
136
+ ```
137
+
138
+ ## 6. 权重与许可证说明
139
+
140
+ `StarDenoise` 是对 Cosmic Clarity AI 3.6 PyTorch 模型的轻量部署封装;仓库保留了
141
+ 上游 MIT 许可证文本和实现说明。`StarNetPyTorch` 是 StarNet 架构的 PyTorch 转写与
142
+ 权重转换/推理示例。第三方代码、样例和权重仍受各自上游许可证或使用条款约束;
143
+ 用于商业产品前请自行核对对应上游授权。本仓库上传权重的目的仅为复现与部署便利,
144
+ 不改变其原始权利归属。
145
+
146
+ ## 7. 快速自检
147
+
148
+ ```powershell
149
+ conda activate study
150
+ python -m unittest discover -s StarDenoise/tests -v
151
+ python -m compileall -q download_models.py StarDenoise StarNetPyTorch
152
+ ```