Coder Social home page Coder Social logo

timedevblocker / transientvit Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 4.94 MB

TransientViT: A novel CNN - Vision Transformer hybrid real/bogus transient classifier for the Kilodegree Automatic Transient Survey

Home Page: https://arxiv.org/abs/2309.09937

License: GNU General Public License v3.0

Python 99.99% Shell 0.01%

transientvit's Introduction

TransientViT: A novel CNN - Vision Transformer hybrid real/bogus transient classifier for the Kilodegree Automatic Transient Survey

TransientViT is a CNN - Vision Transformer (ViT) hybird model to differentiate between transients (real detections) and image artifacts (bogus detections) for the Kilodegree Automatic Transient Survey (KATS). Some image samples are provided in ./images for evaluation.

Quickstart Guide

0. 环境

pip install -r requirements.txt

1. 数据准备

将待分类的图片放置于images

images的目录结构如下所示

images
├── 1230719191550003741.jpg
├── 1230719194852001012.jpg
├── 1230719195125006555.jpg
├── ...
└── 6230719202803006276.jpg

2. 推理

2.1 多文件推理

运行下述代码,完成对images文件夹内所有图片的推理,并输出json文件

python inference.py --img-src images --device 0 --out-path output/result.json

运行结束后,检查输出文件:output/results.json,即可查看类别,置信度以及cross inference的具体推理结果

注:上述代码同rb_classify.sh脚本的内容相同


2.2 单文件推理

运行下述代码,完成单个图像的推理,并输出json文件

python inference.py --img-src images/6230719202803006276.jpg --device 0 --out-path output/result_single.json

运行结束后,检查输出文件:output/results_single.json,即可查看类别,置信度以及cross inference的具体推理结果

注:上述代码同rb_single_classify.sh脚本的内容相同


2.3 推理结果

推理结果的格式为列表嵌套多个字典,每个字典即为一张3x2或3x3的instance分类结果

(1)file_name:该instance的图片名

(2)class:该instance的类别

(3)conf:该instance为上述类别的置信度

(4)cross_inf_result:键(如'0,1', '0,2')即为cross inference所取的NRD图像的索引,值的conf即为该索引下推理的置信度,vote为该索引下推理得到的类别

[
    {
        "file_name": "1230719194852001012.jpg",
        "class": "real",
        "conf": 0.958899974822998,
        "cross_inf_result": {
            "0,1": {
                "conf": 0.9520036578178406,
                "vote": "real"
            },
            "0,2": {
                "conf": 0.9649118781089783,
                "vote": "real"
            },
            "1,2": {
                "conf": 0.9597845077514648,
                "vote": "real"
            }
        }
    },
]

Dataset

KATS Image Sample

Image Preprocessing

Model Architecture

Overall Architecture

Hierarchical Attention Block

Adaptive Cross-Attention Head

Cross Inference

A voting-based ensemble is applied to the three inference results in order to obtain the final result.

Model Performances

Confusion Matrix

Training and Validation Loss

ROC Curve

Distribution of output probability (to be real). Red and blue colors show the histograms for real and bogus samples respectively.

Ablation Study

transientvit's People

Contributors

timedevblocker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.