spikezoo 0.2.3.4__tar.gz → 0.2.3.6__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- spikezoo-0.2.3.6/PKG-INFO +151 -0
- spikezoo-0.2.3.6/spikezoo/archs/__pycache__/__init__.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/base/__pycache__/nets.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/bsf/models/bsf/__pycache__/align.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/bsf/models/bsf/__pycache__/bsf.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/bsf/models/bsf/__pycache__/rep.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/spikeclip/__pycache__/nets.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/spk2imgnet/__pycache__/DCNv2.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/spk2imgnet/__pycache__/align_arch.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/spk2imgnet/__pycache__/nets.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/ssir/models/__pycache__/layers.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/ssir/models/__pycache__/networks.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/ssml/__pycache__/cbam.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/ssml/__pycache__/model.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/stir/metrics/__pycache__/losses.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/stir/models/__pycache__/Vgg19.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/stir/models/__pycache__/networks_STIR.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/stir/models/__pycache__/submodules.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/stir/models/__pycache__/transformer_new.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/stir/package_core/package_core/__pycache__/__init__.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/stir/package_core/package_core/__pycache__/geometry.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/stir/package_core/package_core/__pycache__/image_proc.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/stir/package_core/package_core/__pycache__/losses.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/stir/package_core/package_core/__pycache__/net_basics.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/tfi/__pycache__/nets.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/tfp/__pycache__/nets.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/wgse/__pycache__/dwtnets.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/wgse/__pycache__/submodules.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/yourmodel/arch/__pycache__/net.cpython-39.pyc +0 -0
- spikezoo-0.2.3.6/spikezoo/archs/yourmodel/arch/net.py +35 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/datasets/__init__.py +20 -21
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/datasets/base_dataset.py +26 -21
- spikezoo-0.2.3.4/spikezoo/datasets/realworld_dataset.py → spikezoo-0.2.3.6/spikezoo/datasets/realdata_dataset.py +5 -7
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/datasets/reds_base_dataset.py +1 -1
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/datasets/szdata_dataset.py +1 -5
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/datasets/uhsr_dataset.py +1 -1
- spikezoo-0.2.3.6/spikezoo/datasets/yourdataset_dataset.py +23 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/__init__.py +12 -8
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/base_model.py +10 -4
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/bsf_model.py +0 -1
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/spk2imgnet_model.py +0 -1
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/stir_model.py +0 -1
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/wgse_model.py +0 -1
- spikezoo-0.2.3.6/spikezoo/models/yourmodel_model.py +22 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/pipeline/base_pipeline.py +17 -10
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/pipeline/ensemble_pipeline.py +2 -1
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/pipeline/train_cfgs.py +3 -1
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/pipeline/train_pipeline.py +12 -12
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/utils/spike_utils.py +2 -2
- spikezoo-0.2.3.6/spikezoo.egg-info/PKG-INFO +151 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo.egg-info/SOURCES.txt +32 -2
- spikezoo-0.2.3.4/PKG-INFO +0 -259
- spikezoo-0.2.3.4/spikezoo/data/base/train/spike/203_part4_key_id151.dat +0 -0
- spikezoo-0.2.3.4/spikezoo.egg-info/PKG-INFO +0 -259
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/LICENSE.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/setup.cfg +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/__init__.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/__init__.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/base/nets.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/README.md +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/datasets/datasets.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/datasets/ds_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/main.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/metrics/psnr.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/metrics/ssim.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/models/bsf/align.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/models/bsf/bsf.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/models/bsf/dsft_convert.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/models/bsf/rep.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/models/get_model.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/prepare_data/DSFT.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/prepare_data/crop_dataset_train.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/prepare_data/crop_dataset_val.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/prepare_data/crop_train.sh +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/prepare_data/crop_val.sh +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/prepare_data/io_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/requirements.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/test.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/bsf/utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spikeclip/nets.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spk2imgnet/.github/workflows/pylint.yml +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spk2imgnet/.gitignore +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spk2imgnet/DCNv2.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spk2imgnet/align_arch.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spk2imgnet/dataset.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spk2imgnet/nets.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spk2imgnet/readme.md +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spk2imgnet/test_gen_imgseq.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spk2imgnet/train.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/spk2imgnet/utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/README.md +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/configs/SSIR.yml +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/configs/yml_parser.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/datasets/dataset_sreds.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/datasets/ds_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/losses.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/main.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/metrics/psnr.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/metrics/ssim.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/models/Vgg19.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/models/layers.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/models/networks.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/requirements.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/shells/eval_SREDS.sh +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/shells/train_SSIR.sh +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/test.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssir/utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssml/cbam.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssml/model.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssml/res.png +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/ssml/test.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/.git-credentials +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/README.md +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/ckpt_outputs/Descriptions.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/configs/STIR.yml +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/configs/utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/configs/yml_parser.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/datasets/dataset_sreds.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/datasets/ds_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/eval_SREDS.sh +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/main.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/metrics/losses.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/metrics/psnr.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/metrics/ssim.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/models/Vgg19.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/models/networks_STIR.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/models/submodules.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/models/transformer_new.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/__init__.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/convertions.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/disp_netS.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/flow_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/generic_train_test.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/geometry.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/image_proc.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/linalg.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/losses.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/metrics.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/model_base.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/net_basics.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/resnet.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/transforms.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/build/lib/package_core/utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/dist/package_core-0.0.0-py3.9.egg +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/__init__.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/convertions.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/disp_netS.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/flow_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/generic_train_test.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/geometry.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/image_proc.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/linalg.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/losses.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/metrics.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/model_base.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/net_basics.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/resnet.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/transforms.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core/utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core.egg-info/PKG-INFO +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core.egg-info/SOURCES.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core.egg-info/dependency_links.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/package_core.egg-info/top_level.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/package_core/setup.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/requirements.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/stir/train_STIR.sh +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/tfi/nets.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/tfp/nets.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/README.md +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/dataset.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/demo.png +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/demo.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/dwtnets.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/eval.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/logs/WGSE-Dwt1dNet-db8-5-ks3/log.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/submodules.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/train.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/transform.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/archs/wgse/weights/demo.png +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/test/gt/200_part1_key_id151.png +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/test/gt/200_part3_key_id151.png +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/test/gt/203_part1_key_id151.png +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/test/spike/200_part1_key_id151.dat +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/test/spike/200_part3_key_id151.dat +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/test/spike/203_part1_key_id151.dat +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/train/gt/203_part2_key_id151.png +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/train/gt/203_part3_key_id151.png +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/train/gt/203_part4_key_id151.png +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/train/spike/203_part2_key_id151.dat +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/data/base/train/spike/203_part3_key_id151.dat +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/metrics/__init__.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/spikeclip_model.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/ssir_model.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/ssml_model.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/tfi_model.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/models/tfp_model.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/pipeline/__init__.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/utils/__init__.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/utils/data_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/utils/img_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/utils/optimizer_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/utils/other_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/utils/scheduler_utils.py +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo/utils/vidar_loader.cpython-39-x86_64-linux-gnu.so +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo.egg-info/dependency_links.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo.egg-info/requires.txt +0 -0
- {spikezoo-0.2.3.4 → spikezoo-0.2.3.6}/spikezoo.egg-info/top_level.txt +0 -0
@@ -0,0 +1,151 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: spikezoo
|
3
|
+
Version: 0.2.3.6
|
4
|
+
Summary: A deep learning toolbox for spike-to-image models.
|
5
|
+
Home-page: https://github.com/chenkang455/Spike-Zoo
|
6
|
+
Author: Kang Chen
|
7
|
+
Author-email: mrchenkang@stu.pku.edu.cn
|
8
|
+
Requires-Python: >=3.7
|
9
|
+
Description-Content-Type: text/markdown
|
10
|
+
License-File: LICENSE.txt
|
11
|
+
Requires-Dist: torch
|
12
|
+
Requires-Dist: requests
|
13
|
+
Requires-Dist: numpy
|
14
|
+
Requires-Dist: tqdm
|
15
|
+
Requires-Dist: scikit-image
|
16
|
+
Requires-Dist: lpips
|
17
|
+
Requires-Dist: pyiqa
|
18
|
+
Requires-Dist: opencv-python
|
19
|
+
Requires-Dist: thop
|
20
|
+
Requires-Dist: pytorch-wavelets
|
21
|
+
Requires-Dist: pytz
|
22
|
+
Requires-Dist: PyWavelets
|
23
|
+
Requires-Dist: pandas
|
24
|
+
Requires-Dist: pillow
|
25
|
+
Requires-Dist: scikit-learn
|
26
|
+
Requires-Dist: scipy
|
27
|
+
Requires-Dist: spikingjelly
|
28
|
+
Requires-Dist: setuptools
|
29
|
+
Dynamic: author
|
30
|
+
Dynamic: author-email
|
31
|
+
Dynamic: description
|
32
|
+
Dynamic: description-content-type
|
33
|
+
Dynamic: home-page
|
34
|
+
Dynamic: requires-dist
|
35
|
+
Dynamic: requires-python
|
36
|
+
Dynamic: summary
|
37
|
+
|
38
|
+
<p align="center">
|
39
|
+
<img src="imgs/spike-zoo.png" width="300"/>
|
40
|
+
<p>
|
41
|
+
|
42
|
+
<h5 align="center">
|
43
|
+
|
44
|
+
[](https://github.com/chenkang455/Spike-Zoo/stargazers) [](https://github.com/chenkang455/Spike-Zoo/issues) <a href="https://badge.fury.io/py/spikezoo"><img src="https://badge.fury.io/py/spikezoo.svg" alt="PyPI version"></a> <a href='https://spike-zoo.readthedocs.io/zh-cn/latest/index.html'><img src='https://readthedocs.com/projects/plenoptix-nerfstudio/badge/?version=latest' alt='Documentation Status' /></a>[](https://github.com/chenkang455/Spike-Zoo)
|
45
|
+
<p>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<!-- <h2 align="center">
|
50
|
+
<a href="">⚡Spike-Zoo:
|
51
|
+
</a>
|
52
|
+
</h2> -->
|
53
|
+
|
54
|
+
## 📖 About
|
55
|
+
⚡Spike-Zoo is the go-to library for state-of-the-art pretrained **spike-to-image** models designed to reconstruct images from spike streams. Whether you're looking for a simple inference solution or aiming to train your own spike-to-image models, ⚡Spike-Zoo is a modular toolbox that supports both, with key features including:
|
56
|
+
|
57
|
+
- Fast inference with pre-trained models.
|
58
|
+
- Training support for custom-designed spike-to-image models.
|
59
|
+
- Specialized functions for processing spike data.
|
60
|
+
|
61
|
+
> We are highly looking forward to your advice on our project. We welcome any issues or code contributions and will respond within one day.
|
62
|
+
|
63
|
+
## 🚩 Updates/Changelog
|
64
|
+
* **25-02-02:** Release the `Spike-Zoo v0.2` code, which supports more methods, provide more usages like training your method from scratch.
|
65
|
+
* **24-07-19:** Release the `Spike-Zoo v0.1` code for base evaluation of SOTA methods.
|
66
|
+
|
67
|
+
## 🍾 Quick Start
|
68
|
+
### 1. Installation
|
69
|
+
For users focused on **utilizing pretrained models for spike-to-image conversion**, we recommend installing SpikeZoo using one of the following methods:
|
70
|
+
|
71
|
+
* Install the last stable version `0.2.3.5` from PyPI:
|
72
|
+
```
|
73
|
+
pip install spikezoo
|
74
|
+
```
|
75
|
+
* Install the latest developing version `0.2.3.6` from the source code **(recommended)**:
|
76
|
+
```
|
77
|
+
git clone https://github.com/chenkang455/Spike-Zoo
|
78
|
+
cd Spike-Zoo
|
79
|
+
python setup.py install
|
80
|
+
```
|
81
|
+
|
82
|
+
For users interested in **training their own spike-to-image model based on our framework**, we recommend cloning the repository and modifying the related code directly.
|
83
|
+
```
|
84
|
+
git clone https://github.com/chenkang455/Spike-Zoo
|
85
|
+
cd Spike-Zoo
|
86
|
+
python setup.py develop
|
87
|
+
```
|
88
|
+
|
89
|
+
### 2. Inference
|
90
|
+
Reconstructing images from the spike is super easy with Spike-Zoo. Try the following code of the single model:
|
91
|
+
``` python
|
92
|
+
from spikezoo.pipeline import Pipeline, PipelineConfig
|
93
|
+
import spikezoo as sz
|
94
|
+
pipeline = Pipeline(
|
95
|
+
cfg=PipelineConfig(save_folder="results",version="v023"),
|
96
|
+
model_cfg=sz.METHOD.BASE,
|
97
|
+
dataset_cfg=sz.DATASET.BASE
|
98
|
+
)
|
99
|
+
pipeline.infer_from_dataset(idx = 0)
|
100
|
+
```
|
101
|
+
|
102
|
+
|
103
|
+
### 3. Training
|
104
|
+
We provide a user-friendly code for training our provided `BASE` model (modified from the `SpikeCLIP`) for the classic `REDS` dataset introduced in `Spk2ImgNet`:
|
105
|
+
``` python
|
106
|
+
from spikezoo.pipeline import TrainPipelineConfig, TrainPipeline
|
107
|
+
from spikezoo.datasets.reds_base_dataset import REDS_BASEConfig
|
108
|
+
from spikezoo.models.base_model import BaseModelConfig
|
109
|
+
pipeline = TrainPipeline(
|
110
|
+
cfg=TrainPipelineConfig(save_folder="results", epochs = 10),
|
111
|
+
dataset_cfg=REDS_BASEConfig(root_dir = "spikezoo/data/reds_base"),
|
112
|
+
model_cfg=BaseModelConfig(),
|
113
|
+
)
|
114
|
+
pipeline.train()
|
115
|
+
```
|
116
|
+
We finish the training with one 4090 GPU in `2 minutes`, achieving `32.8dB` in PSNR and `0.92` in SSIM.
|
117
|
+
|
118
|
+
> 🌟 We encourage users to develop their models with simple modifications to our framework.
|
119
|
+
|
120
|
+
## 📚 How to navigate the documentation
|
121
|
+
|
122
|
+
| **Link** | **Description** |
|
123
|
+
| --- | --- |
|
124
|
+
| [Quick Start](https://spike-zoo.readthedocs.io/zh-cn/latest/%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B.html) | Learn how to quickly get started with the Spike-Zoo repository for inference and training. |
|
125
|
+
| [Dataset](https://spike-zoo.readthedocs.io/zh-cn/latest/%E6%95%B0%E6%8D%AE%E9%9B%86.html) | Learn the parameter configuration of datasets and how to construct them. |
|
126
|
+
| [Model](https://spike-zoo.readthedocs.io/zh-cn/latest/%E6%A8%A1%E5%9E%8B.html) | Learn the parameter configuration of models and how to construct them. |
|
127
|
+
| [Pipeline](https://spike-zoo.readthedocs.io/zh-cn/latest/%E5%A4%84%E7%90%86%E7%AE%A1%E7%BA%BF.html) | Learn how to configure and construct the processing pipeline for models. |
|
128
|
+
| [Released Version](https://spike-zoo.readthedocs.io/zh-cn/latest/%E5%8F%91%E8%A1%8C%E7%89%88%E6%9C%AC%E4%BB%8B%E7%BB%8D.html) | Introduces the differences between different release versions of pre-trained weights. |
|
129
|
+
| [Examples](https://spike-zoo.readthedocs.io/zh-cn/latest/%E4%BD%BF%E7%94%A8%E4%BE%8B%E5%AD%90.html) | Complete code examples for using Spike-Zoo. |
|
130
|
+
| [Supports](https://spike-zoo.readthedocs.io/zh-cn/latest/%E6%94%AF%E6%8C%81%E8%8C%83%E5%9B%B4.html) | Learn about the datasets and models supported by Spike-Zoo. |
|
131
|
+
|
132
|
+
|
133
|
+
## 📅 TODO
|
134
|
+
- [x] Support the overall pipeline for spike simulation.
|
135
|
+
- [x] Provide the tutorials.
|
136
|
+
- [ ] Support more training settings.
|
137
|
+
- [ ] Support more spike-based image reconstruction methods and datasets.
|
138
|
+
|
139
|
+
## ✨ Acknowledgment
|
140
|
+
Our code is built on the open-source projects of [SpikeCV](https://spikecv.github.io/), [IQA-Pytorch](https://github.com/chaofengc/IQA-PyTorch), [BasicSR](https://github.com/XPixelGroup/BasicSR) and [NeRFStudio](https://github.com/nerfstudio-project/nerfstudio).We appreciate the effort of the contributors to these repositories. Thanks for [@zhiwen_huang](https://github.com/hzw-abc), [@ruizhao26](https://github.com/ruizhao26), [@shiyan_chen](https://github.com/hnmizuho) and [@Leozhangjiyuan](https://github.com/Leozhangjiyuan) for their help in building this project.
|
141
|
+
|
142
|
+
## 📑 Citation
|
143
|
+
If you find our codes helpful to your research, please consider to use the following citation:
|
144
|
+
```
|
145
|
+
@misc{spikezoo,
|
146
|
+
title={{Spike-Zoo}: A Toolbox for Spike-to-Image Reconstruction},
|
147
|
+
author={Kang Chen and Zhiyuan Ye and Tiejun Huang and Zhaofei Yu},
|
148
|
+
year={2025},
|
149
|
+
howpublished = {\url{https://github.com/chenkang455/Spike-Zoo}},
|
150
|
+
}
|
151
|
+
```
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
spikezoo-0.2.3.6/spikezoo/archs/stir/package_core/package_core/__pycache__/__init__.cpython-39.pyc
ADDED
Binary file
|
spikezoo-0.2.3.6/spikezoo/archs/stir/package_core/package_core/__pycache__/geometry.cpython-39.pyc
ADDED
Binary file
|
spikezoo-0.2.3.6/spikezoo/archs/stir/package_core/package_core/__pycache__/image_proc.cpython-39.pyc
ADDED
Binary file
|
spikezoo-0.2.3.6/spikezoo/archs/stir/package_core/package_core/__pycache__/losses.cpython-39.pyc
ADDED
Binary file
|
spikezoo-0.2.3.6/spikezoo/archs/stir/package_core/package_core/__pycache__/net_basics.cpython-39.pyc
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import torch.nn as nn
|
2
|
+
|
3
|
+
def conv_layer(inDim, outDim, ks, s, p, norm_layer="none"):
|
4
|
+
## convolutional layer
|
5
|
+
conv = nn.Conv2d(inDim, outDim, kernel_size=ks, stride=s, padding=p)
|
6
|
+
relu = nn.ReLU(True)
|
7
|
+
assert norm_layer in ("batch", "instance", "none")
|
8
|
+
if norm_layer == "none":
|
9
|
+
seq = nn.Sequential(*[conv, relu])
|
10
|
+
else:
|
11
|
+
if norm_layer == "instance":
|
12
|
+
norm = nn.InstanceNorm2d(outDim, affine=False, track_running_stats=False) # instance norm
|
13
|
+
else:
|
14
|
+
momentum = 0.1
|
15
|
+
norm = nn.BatchNorm2d(outDim, momentum=momentum, affine=True, track_running_stats=True)
|
16
|
+
seq = nn.Sequential(*[conv, norm, relu])
|
17
|
+
return seq
|
18
|
+
|
19
|
+
|
20
|
+
class YourNet(nn.Module):
|
21
|
+
"""Borrow the structure from the SpikeCLIP. (https://arxiv.org/abs/2501.04477)"""
|
22
|
+
|
23
|
+
def __init__(self, inDim=41):
|
24
|
+
super(YourNet, self).__init__()
|
25
|
+
norm = "none"
|
26
|
+
outDim = 1
|
27
|
+
convBlock1 = conv_layer(inDim, 64, 3, 1, 1)
|
28
|
+
convBlock2 = conv_layer(64, 128, 3, 1, 1, norm)
|
29
|
+
convBlock3 = conv_layer(128, 64, 3, 1, 1, norm)
|
30
|
+
convBlock4 = conv_layer(64, 16, 3, 1, 1, norm)
|
31
|
+
conv = nn.Conv2d(16, outDim, 3, 1, 1)
|
32
|
+
self.seq = nn.Sequential(*[convBlock1, convBlock2, convBlock3, convBlock4, conv])
|
33
|
+
|
34
|
+
def forward(self, x):
|
35
|
+
return self.seq(x)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from spikezoo.datasets.base_dataset import BaseDataset, BaseDatasetConfig
|
2
|
+
|
2
3
|
from dataclasses import replace
|
3
4
|
import importlib, inspect
|
4
5
|
import os
|
@@ -12,23 +13,24 @@ dataset_list = [file.replace("_dataset.py", "") for file in files_list if file.e
|
|
12
13
|
|
13
14
|
|
14
15
|
# todo register function
|
15
|
-
def build_dataset_cfg(cfg: BaseDatasetConfig
|
16
|
+
def build_dataset_cfg(cfg: BaseDatasetConfig):
|
16
17
|
"""Build the dataset from the given dataset config."""
|
17
|
-
# build new cfg according to split
|
18
|
-
cfg = replace(cfg, split=split, spike_length=cfg.spike_length_train if split == "train" else cfg.spike_length_test)
|
19
18
|
# dataset module
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
if cfg.dataset_cls_local == None:
|
20
|
+
module_name = cfg.dataset_name + "_dataset"
|
21
|
+
assert cfg.dataset_name in dataset_list, f"Given dataset {cfg.dataset_name} not in our dataset list {dataset_list}."
|
22
|
+
module_name = "spikezoo.datasets." + module_name
|
23
|
+
module = importlib.import_module(module_name)
|
24
|
+
# dataset,dataset_config
|
25
|
+
dataset_name = cfg.dataset_name
|
26
|
+
dataset_name = dataset_name + "Dataset" if dataset_name == "base" else dataset_name
|
27
|
+
dataset_cls: BaseDataset = getattr_case_insensitive(module, dataset_name)
|
28
|
+
else:
|
29
|
+
dataset_cls = cfg.dataset_cls_local
|
28
30
|
dataset = dataset_cls(cfg)
|
29
31
|
return dataset
|
30
32
|
|
31
|
-
def build_dataset_name(dataset_name: str
|
33
|
+
def build_dataset_name(dataset_name: str):
|
32
34
|
"""Build the default dataset from the given name."""
|
33
35
|
module_name = dataset_name + "_dataset"
|
34
36
|
assert dataset_name in dataset_list, f"Given dataset {dataset_name} not in our dataset list {dataset_list}."
|
@@ -37,22 +39,19 @@ def build_dataset_name(dataset_name: str, split: Literal["train", "test"] = "tes
|
|
37
39
|
# dataset,dataset_config
|
38
40
|
dataset_name = dataset_name + "Dataset" if dataset_name == "base" else dataset_name
|
39
41
|
dataset_cls: BaseDataset = getattr_case_insensitive(module, dataset_name)
|
40
|
-
dataset_cfg: BaseDatasetConfig = getattr_case_insensitive(module, dataset_name + "config")(
|
42
|
+
dataset_cfg: BaseDatasetConfig = getattr_case_insensitive(module, dataset_name + "config")()
|
41
43
|
dataset = dataset_cls(dataset_cfg)
|
42
44
|
return dataset
|
43
45
|
|
44
46
|
|
45
47
|
# todo to modify according to the basicsr
|
46
|
-
def build_dataloader(dataset
|
48
|
+
def build_dataloader(dataset, cfg):
|
47
49
|
# train dataloader
|
48
|
-
if dataset.
|
49
|
-
|
50
|
-
return torch.utils.data.DataLoader(dataset, batch_size=1, shuffle=False, num_workers=1)
|
51
|
-
else:
|
52
|
-
return torch.utils.data.DataLoader(dataset, batch_size=cfg.bs_train, shuffle=True, num_workers=cfg.num_workers, pin_memory=cfg.pin_memory)
|
50
|
+
if dataset.split == "train" and cfg._mode == "train_mode":
|
51
|
+
return torch.utils.data.DataLoader(dataset, batch_size=cfg.bs_train, shuffle=True, num_workers=cfg.nw_train, pin_memory=cfg.pin_memory)
|
53
52
|
# test dataloader
|
54
|
-
|
55
|
-
return torch.utils.data.DataLoader(dataset, batch_size=
|
53
|
+
else:
|
54
|
+
return torch.utils.data.DataLoader(dataset, batch_size=cfg.bs_test, shuffle=False, num_workers=cfg.nw_test,pin_memory=False)
|
56
55
|
|
57
56
|
|
58
57
|
# dataset_size_dict = {}
|
@@ -11,6 +11,7 @@ import warnings
|
|
11
11
|
import torch
|
12
12
|
from tqdm import tqdm
|
13
13
|
from spikezoo.utils.data_utils import Augmentor
|
14
|
+
from typing import Optional
|
14
15
|
|
15
16
|
|
16
17
|
@dataclass
|
@@ -30,31 +31,24 @@ class BaseDatasetConfig:
|
|
30
31
|
spike_length_train: int = -1
|
31
32
|
"Dataset spike length for the test data."
|
32
33
|
spike_length_test: int = -1
|
33
|
-
"Dataset spike length for the instantiation dataclass."
|
34
|
-
spike_length: int = -1
|
35
34
|
"Dir name for the spike."
|
36
35
|
spike_dir_name: str = "spike"
|
37
36
|
"Dir name for the image."
|
38
37
|
img_dir_name: str = "gt"
|
38
|
+
"Rate. (-1 denotes variant)"
|
39
|
+
rate: float = 0.6
|
39
40
|
|
40
41
|
# ------------- Config -------------
|
41
|
-
"Dataset split: train/test. Default set as the 'test' for evaluation."
|
42
|
-
split: Literal["train", "test"] = "test"
|
43
42
|
"Use the data augumentation technique or not."
|
44
43
|
use_aug: bool = False
|
45
44
|
"Use cache mechanism."
|
46
45
|
use_cache: bool = False
|
47
46
|
"Crop size."
|
48
47
|
crop_size: tuple = (-1, -1)
|
49
|
-
"
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
def __post_init__(self):
|
54
|
-
self.spike_length = self.spike_length_train if self.split == "train" else self.spike_length_test
|
55
|
-
self.root_dir = Path(self.root_dir) if isinstance(self.root_dir, str) else self.root_dir
|
56
|
-
# todo try download
|
57
|
-
assert self.root_dir.exists(), f"No files found in {self.root_dir} for the specified dataset `{self.dataset_name}`."
|
48
|
+
"Load the dataset from local or spikezoo lib."
|
49
|
+
dataset_cls_local: Optional[Dataset] = None
|
50
|
+
"Spike load version. [python,cpp]"
|
51
|
+
spike_load_version: Literal["python", "cpp"] = "python"
|
58
52
|
|
59
53
|
|
60
54
|
# todo cache mechanism
|
@@ -62,10 +56,6 @@ class BaseDataset(Dataset):
|
|
62
56
|
def __init__(self, cfg: BaseDatasetConfig):
|
63
57
|
super(BaseDataset, self).__init__()
|
64
58
|
self.cfg = cfg
|
65
|
-
self.augmentor = Augmentor(self.cfg.crop_size) if self.cfg.use_aug == True and self.cfg.split == "train" else -1
|
66
|
-
self.prepare_data()
|
67
|
-
self.cache_data() if cfg.use_cache == True else -1
|
68
|
-
warnings.warn("Lengths of the image list and the spike list should be equal.") if len(self.img_list) != len(self.spike_list) else -1
|
69
59
|
|
70
60
|
def __len__(self):
|
71
61
|
return len(self.spike_list)
|
@@ -80,7 +70,7 @@ class BaseDataset(Dataset):
|
|
80
70
|
img = self.get_img(idx)
|
81
71
|
|
82
72
|
# process data
|
83
|
-
if self.cfg.use_aug == True and self.
|
73
|
+
if self.cfg.use_aug == True and self.split == "train":
|
84
74
|
spike, img = self.augmentor(spike, img)
|
85
75
|
|
86
76
|
# rate
|
@@ -90,15 +80,29 @@ class BaseDataset(Dataset):
|
|
90
80
|
batch = {"spike": spike, "gt_img": img, "rate": rate}
|
91
81
|
return batch
|
92
82
|
|
83
|
+
def build_source(self, split: Literal["train", "test"] = "test"):
|
84
|
+
"""Build the dataset source and prepare to be loaded files."""
|
85
|
+
# spike length
|
86
|
+
self.split = split
|
87
|
+
self.spike_length = self.cfg.spike_length_train if self.split == "train" else self.cfg.spike_length_test
|
88
|
+
# root dir
|
89
|
+
self.cfg.root_dir = Path(self.cfg.root_dir) if isinstance(self.cfg.root_dir, str) else self.cfg.root_dir
|
90
|
+
assert self.cfg.root_dir.exists(), f"No files found in {self.cfg.root_dir} for the specified dataset `{self.cfg.dataset_name}`."
|
91
|
+
# prepare
|
92
|
+
self.augmentor = Augmentor(self.cfg.crop_size) if self.cfg.use_aug == True and self.split == "train" else -1
|
93
|
+
self.prepare_data()
|
94
|
+
self.cache_data() if self.cfg.use_cache == True else -1
|
95
|
+
warnings.warn("Lengths of the image list and the spike list should be equal.") if len(self.img_list) != len(self.spike_list) else -1
|
96
|
+
|
93
97
|
# todo: To be overridden
|
94
98
|
def prepare_data(self):
|
95
99
|
"""Specify the spike and image files to be loaded."""
|
96
100
|
# spike
|
97
|
-
self.spike_dir = self.cfg.root_dir / self.
|
101
|
+
self.spike_dir = self.cfg.root_dir / self.split / self.cfg.spike_dir_name
|
98
102
|
self.spike_list = self.get_spike_files(self.spike_dir)
|
99
103
|
# gt
|
100
104
|
if self.cfg.with_img == True:
|
101
|
-
self.img_dir = self.cfg.root_dir / self.
|
105
|
+
self.img_dir = self.cfg.root_dir / self.split / self.cfg.img_dir_name
|
102
106
|
self.img_list = self.get_image_files(self.img_dir)
|
103
107
|
|
104
108
|
# todo: To be overridden
|
@@ -116,12 +120,13 @@ class BaseDataset(Dataset):
|
|
116
120
|
height=self.cfg.height,
|
117
121
|
width=self.cfg.width,
|
118
122
|
out_format="tensor",
|
123
|
+
version=self.cfg.spike_load_version
|
119
124
|
)
|
120
125
|
return spike
|
121
126
|
|
122
127
|
def get_spike(self, idx):
|
123
128
|
"""Get and process the spike stream from the given idx."""
|
124
|
-
spike_length = self.
|
129
|
+
spike_length = self.spike_length
|
125
130
|
spike = self.load_spike(idx)
|
126
131
|
assert spike.shape[0] >= spike_length, f"Given spike length {spike.shape[0]} smaller than the required length {spike_length}"
|
127
132
|
spike_mid = spike.shape[0] // 2
|
@@ -4,21 +4,19 @@ from dataclasses import dataclass
|
|
4
4
|
|
5
5
|
|
6
6
|
@dataclass
|
7
|
-
class
|
8
|
-
dataset_name: str = "
|
9
|
-
root_dir: Path = Path(__file__).parent.parent / Path("data/
|
7
|
+
class RealDataConfig(BaseDatasetConfig):
|
8
|
+
dataset_name: str = "realdata"
|
9
|
+
root_dir: Path = Path(__file__).parent.parent / Path("data/realdata")
|
10
10
|
width: int = 400
|
11
11
|
height: int = 250
|
12
12
|
with_img: bool = False
|
13
13
|
spike_length_train: int = -1
|
14
14
|
spike_length_test: int = -1
|
15
15
|
rate: float = 1
|
16
|
-
|
17
16
|
|
18
|
-
|
19
|
-
class RealWorld(BaseDataset):
|
17
|
+
class RealData(BaseDataset):
|
20
18
|
def __init__(self, cfg: BaseDatasetConfig):
|
21
|
-
super(
|
19
|
+
super(RealData, self).__init__(cfg)
|
22
20
|
|
23
21
|
def prepare_data(self):
|
24
22
|
self.spike_dir = self.cfg.root_dir
|
@@ -8,7 +8,7 @@ import re
|
|
8
8
|
@dataclass
|
9
9
|
class REDS_BASEConfig(BaseDatasetConfig):
|
10
10
|
dataset_name: str = "reds_base"
|
11
|
-
root_dir: Path = Path(__file__).parent.parent / Path("data/
|
11
|
+
root_dir: Path = Path(__file__).parent.parent / Path("data/reds_base")
|
12
12
|
width: int = 400
|
13
13
|
height: int = 250
|
14
14
|
with_img: bool = True
|
@@ -9,7 +9,7 @@ import numpy as np
|
|
9
9
|
@dataclass
|
10
10
|
class SZDataConfig(BaseDatasetConfig):
|
11
11
|
dataset_name: str = "szdata"
|
12
|
-
root_dir: Path = Path(__file__).parent.parent / Path("data/
|
12
|
+
root_dir: Path = Path(__file__).parent.parent / Path("data/szdata")
|
13
13
|
width: int = 400
|
14
14
|
height: int = 250
|
15
15
|
with_img: bool = True
|
@@ -22,7 +22,3 @@ class SZDataConfig(BaseDatasetConfig):
|
|
22
22
|
class SZData(BaseDataset):
|
23
23
|
def __init__(self, cfg: BaseDatasetConfig):
|
24
24
|
super(SZData, self).__init__(cfg)
|
25
|
-
|
26
|
-
def prepare_data(self):
|
27
|
-
super().prepare_data()
|
28
|
-
self.img_list = [self.img_dir / Path(str(s.name).replace('.dat','.png')) for s in self.spike_list]
|
@@ -7,7 +7,7 @@ import torch
|
|
7
7
|
@dataclass
|
8
8
|
class UHSRConfig(BaseDatasetConfig):
|
9
9
|
dataset_name: str = "uhsr"
|
10
|
-
root_dir: Path = Path(__file__).parent.parent / Path("data/
|
10
|
+
root_dir: Path = Path(__file__).parent.parent / Path("data/u_caltech")
|
11
11
|
width: int = 224
|
12
12
|
height: int = 224
|
13
13
|
with_img: bool = False
|
@@ -0,0 +1,23 @@
|
|
1
|
+
from torch.utils.data import Dataset
|
2
|
+
from pathlib import Path
|
3
|
+
from dataclasses import dataclass
|
4
|
+
from typing import Literal, Union
|
5
|
+
from typing import Optional
|
6
|
+
from spikezoo.datasets.base_dataset import BaseDatasetConfig,BaseDataset
|
7
|
+
|
8
|
+
@dataclass
|
9
|
+
class YourDatasetConfig(BaseDatasetConfig):
|
10
|
+
dataset_name: str = "yourdataset"
|
11
|
+
root_dir: Union[str, Path] = Path(__file__).parent.parent / Path("data/your_data_path")
|
12
|
+
width: int = 400
|
13
|
+
height: int = 250
|
14
|
+
with_img: bool = True
|
15
|
+
spike_length_train: int = -1
|
16
|
+
spike_length_test: int = -1
|
17
|
+
spike_dir_name: str = "spike_data"
|
18
|
+
img_dir_name: str = "sharp_data"
|
19
|
+
rate: float = 1
|
20
|
+
|
21
|
+
class YourDataset(BaseDataset):
|
22
|
+
def __init__(self, cfg: BaseDatasetConfig):
|
23
|
+
super(YourDataset, self).__init__(cfg)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import importlib
|
2
2
|
import inspect
|
3
3
|
from spikezoo.models.base_model import BaseModel,BaseModelConfig
|
4
|
+
|
4
5
|
from spikezoo.utils.other_utils import getattr_case_insensitive
|
5
6
|
import os
|
6
7
|
from pathlib import Path
|
@@ -13,14 +14,17 @@ model_list = [file.split("_")[0] for file in files_list if file.endswith("_model
|
|
13
14
|
def build_model_cfg(cfg: BaseModelConfig):
|
14
15
|
"""Build the model from the given model config."""
|
15
16
|
# model module name
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
if cfg.model_cls_local == None:
|
18
|
+
module_name = cfg.model_name + "_model"
|
19
|
+
assert cfg.model_name in model_list, f"Given model {cfg.model_name} not in our model zoo {model_list}."
|
20
|
+
module_name = "spikezoo.models." + module_name
|
21
|
+
module = importlib.import_module(module_name)
|
22
|
+
# model,model_config
|
23
|
+
model_name = cfg.model_name
|
24
|
+
model_name = model_name + 'Model' if model_name == "base" else model_name
|
25
|
+
model_cls: BaseModel = getattr_case_insensitive(module,model_name)
|
26
|
+
else:
|
27
|
+
model_cls: BaseModel = cfg.model_cls_local
|
24
28
|
model = model_cls(cfg)
|
25
29
|
return model
|
26
30
|
|
@@ -44,7 +44,10 @@ class BaseModelConfig:
|
|
44
44
|
multi_gpu: bool = False
|
45
45
|
"Base url."
|
46
46
|
base_url: str = "https://github.com/chenkang455/Spike-Zoo/releases/download"
|
47
|
-
|
47
|
+
"Load the model from local class or spikezoo lib. (None)"
|
48
|
+
model_cls_local: Optional[nn.Module] = None
|
49
|
+
"Load the arch from local class or spikezoo lib. (None)"
|
50
|
+
arch_cls_local: Optional[nn.Module] = None
|
48
51
|
|
49
52
|
class BaseModel(nn.Module):
|
50
53
|
def __init__(self, cfg: BaseModelConfig):
|
@@ -71,8 +74,11 @@ class BaseModel(nn.Module):
|
|
71
74
|
):
|
72
75
|
"""Build the network and load the pretrained weight."""
|
73
76
|
# network
|
74
|
-
|
75
|
-
|
77
|
+
if self.cfg.arch_cls_local == None:
|
78
|
+
module = importlib.import_module(f"spikezoo.archs.{self.cfg.model_name}.{self.cfg.model_file_name}")
|
79
|
+
model_cls = getattr(module, self.cfg.model_cls_name)
|
80
|
+
else:
|
81
|
+
model_cls = self.cfg.arch_cls_local
|
76
82
|
# load model config parameters
|
77
83
|
if version == "local":
|
78
84
|
model = model_cls(**self.cfg.model_params)
|
@@ -129,7 +135,7 @@ class BaseModel(nn.Module):
|
|
129
135
|
"""Crop the spike length."""
|
130
136
|
spike_length = spike.shape[1]
|
131
137
|
spike_mid = spike_length // 2
|
132
|
-
assert spike_length >= self.model_length, f"Spike input is not long enough, given {spike_length} frames < {self.cfg.model_length}."
|
138
|
+
assert spike_length >= self.model_length, f"Spike input is not long enough, given {spike_length} frames < {self.cfg.model_length} required by the {self.cfg.model_name}."
|
133
139
|
# even length
|
134
140
|
if self.model_length == self.model_half_length * 2:
|
135
141
|
spike = spike[
|
@@ -4,7 +4,6 @@ from spikezoo.models.base_model import BaseModel, BaseModelConfig
|
|
4
4
|
from torch.optim import Adam
|
5
5
|
import torch.optim.lr_scheduler as lr_scheduler
|
6
6
|
import torch.nn as nn
|
7
|
-
from spikezoo.pipeline import TrainPipelineConfig
|
8
7
|
from typing import List
|
9
8
|
from spikezoo.archs.bsf.models.bsf.bsf import BSF
|
10
9
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import torch
|
2
2
|
from dataclasses import dataclass, field
|
3
3
|
from spikezoo.models.base_model import BaseModel, BaseModelConfig
|
4
|
-
from spikezoo.pipeline import TrainPipelineConfig
|
5
4
|
import torch.nn as nn
|
6
5
|
import torch.optim as optim
|
7
6
|
import torch.optim.lr_scheduler as lr_scheduler
|
@@ -4,7 +4,6 @@ from spikezoo.models.base_model import BaseModel, BaseModelConfig
|
|
4
4
|
from torch.optim import Adam
|
5
5
|
import torch.optim.lr_scheduler as lr_scheduler
|
6
6
|
import torch.nn as nn
|
7
|
-
from spikezoo.pipeline import TrainPipelineConfig
|
8
7
|
from typing import List
|
9
8
|
from spikezoo.archs.stir.metrics.losses import compute_per_loss_single
|
10
9
|
from spikezoo.archs.stir.models.Vgg19 import Vgg19
|
@@ -1,7 +1,6 @@
|
|
1
1
|
from dataclasses import dataclass, field
|
2
2
|
from spikezoo.models.base_model import BaseModel, BaseModelConfig
|
3
3
|
from typing import List
|
4
|
-
from spikezoo.pipeline import TrainPipelineConfig
|
5
4
|
import torch.nn as nn
|
6
5
|
import torch.optim as optim
|
7
6
|
import torch.optim.lr_scheduler as lr_scheduler
|