没有项目描述
deepCR的Python项目详细描述
deepcr:基于深度学习的天文图像宇宙线去除
利用经过训练的卷积神经网络识别和去除天文图像中的宇宙射线。
文档和教程:https://deepcr.readthedocs.io/
这是一个可安装的软件包,它实现了论文中描述的方法:zhang&bloom(2019),提交。
本文中再现基准测试结果的代码位于:https://github.com/kmzzhang/deepCR-paper
如果您使用此软件包,请引用Zhang&;Bloom(2019):https://arxiv.org/abs/1907.09500并考虑包括 链接到此存储库。
注:当前版本仅包括HST ACS/WFC的型号。
安装
pip install deepCR
或者您可以从源安装:
git clone https://github.com/profjsb/deepCR.git
cd deepCR/
python setup.py install
快速启动
快速下载HST ACS/WFC图像
wget -O jdba2sooq_flc.fits https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/jdba2sooq_flc.fits
使用python>;=3.5:
对于较小尺寸的图像
fromdeepCRimportdeepCRfromastropy.ioimportfitsimage=fits.getdata("jdba2sooq_flc.fits")[:512,:512]# create an instance of deepCR with specified model configurationmdl=deepCR(mask="ACS-WFC-F606W-2-32",inpaint="ACS-WFC-F606W-2-32",device="CPU")# apply to input imagemask,cleaned_image=mdl.clean(image,threshold=0.5)# best threshold is highest value that generate mask covering full extent of CR# choose threshold by visualizing outputs.# note that deepCR-inpaint would overestimate if mask does not fully cover CR.# if you only need CR mask you may skip image inpainting for shorter runtimemask=mdl.clean(image,threshold=0.5,inpaint=False)# if you want probabilistic cosmic ray mask instead of binary maskprob_mask=mdl.clean(image,binary=False)
对于wfc全尺寸图像(4k*2k),您应该指定segment=true告诉deepcr将输入图像分割成256*256个补丁,并一次处理一个补丁。 否则将占用10GB内存。我们建议对CPU上大于1K*1K的图像使用segment=true。GPU内存限制可能更严格。
image=fits.getdata("jdba2sooq_flc.fits")mask,cleaned_image=mdl.clean(image,threshold=0.5,segment=True)
(仅限CPU)代替segment=true,您还可以指定parallel=true并调用段模式的多线程版本。这会加快速度。不必再次指定segment=true。
image=fits.getdata("jdba2sooq_flc.fits")mask,cleaned_image=mdl.clean(image,threshold=0.5,parallel=True,n_jobs=-1)
n_jobs=-1使用所有的CPU核心。
注意,如果你使用gpu,这不会加快速度!
当前可用型号
遮罩:
ACS-WFC-F606W-2-4
ACS-WFC-F606W-2-32(*)
修补:
ACS-WFC-F606W-2-32(*)
ACS-WFC-F606W-3-32
推荐型号用(*)标记。数字越大表示容量越大。
输入图像应该来自以电子为单位的_flc.fits文件。
限制和注意事项
目前包括的模型是训练和基准的HST ACS/WFC图像在F606W滤波器。
目视检查显示,这些型号的滤光片在f435w到f814w的滤光片上也能很好地工作。但是,用户应该对短波滤光片使用更高的阈值(例如0.9),以尽量减少错误检测(如果有的话)。
贡献
我们非常有兴趣从社区获得错误修复、新功能和新的训练模型(特别是地面成像和光谱学)。请离开这个回购协议,并发布一个公关与您的变化。如果您为更改添加一些测试,这将特别有用。