Waller-Lab/EncodingInformation
GitHub: Waller-Lab/EncodingInformation
基于信息论的计算成像工具包,通过多种概率模型估计成像测量数据中的信息含量及置信区间,辅助成像系统的优化设计。
Stars: 25 | Forks: 11
[](https://encodinginformation.readthedocs.io/en/latest/?badge=latest)
[](https://github.com/EncodingInformation/EncodingInformation/raw/master/LICENSE)
[](https://pypi.org/project/encoding-information)
[](https://pypistats.org/packages/encoding_information)
论文 [信息驱动的成像系统设计](https://waller-lab.github.io/EncodingInformationWebsite/) 的代码与实验。
有关详细用法,请参阅[文档](https://encodinginformation.readthedocs.io/en/latest/)。
## 安装指南
`pip install encoding_information`
可能需要更多设置才能获得正确版本的 Jax/Flax,请参阅:
https://github.com/Waller-Lab/EncodingInformation/blob/main/Installation_guide.md
## 快速入门
```
from encoding_information.models import PixelCNN, PoissonNoiseModel
from encoding_information import estimate_information, extract_patches
# 加载测量数据(图像的 N x H x W numpy array)
measurements = load_measurements()
# 拆分为 training/test sets 并提取 patches
# 将大图像分解为 patches 可提高计算效率
# test set 用于评估信息估计值
patches = extract_patches(measurements[:-200], patch_size=16)
test_patches = extract_patches(measurements[-200:], patch_size=16)
# 初始化 model 并将其拟合到 training data
model = PixelCNN() # Also supports FullGaussianProcess, StationaryGaussianProcess
noise_model = PoissonNoiseModel()
model.fit(patches)
# 估计信息内容及 confidence bounds
# Error bars 根据 test set 大小进行计算
info, lower_bound, upper_bound = estimate_information(
model,
noise_model,
patches,
test_patches,
confidence_interval=0.95
)
print(f"Information: {info:.2f} ± {(upper_bound-lower_bound)/2:.2f} bits/pixel")
```
我们提供三种具有不同权衡的模型:
- **PixelCNN**:估计最准确,但速度最慢
- **FullGaussianProcess**:速度最快
- **StationaryGaussianProcess**:速度居中;在数据有限的情况下性能最佳
为了获得最高精度,请训练多个模型并选择给出最低信息估计的模型,因为每个模型都提供了真实信息量的上限。
## 文档
https://encodinginformation.readthedocs.io/en/latest/
标签:逆向工具