Views
No views yet
| Metric | FCN4Flare | Flatwrm2 | Stella |
|---|---|---|---|
| Recall | 0.67 | 0.26 | 0.50 |
| Precision | 0.69 | 0.08 | 0.09 |
| F1 Score | 0.64 | 0.13 | 0.16 |
| Average Precision | 0.55 | 0.12 | 0.14 |
| Dice Coefficient | 0.64 | 0.12 | 0.15 |
| Intersection over Union (IoU) | 0.54 | 0.10 | 0.13 |
1from transformers import AutoModel
2import torch
3
4model = AutoModel.from_pretrained("Maxwell-Jia/fcn4flare")
5
6# Load your data and create required tensors
7# You need to implement your own data loading logic that returns:
8# 1. input_features: tensor of flux values, shape [batch_size, sequence_length, 1]
9# - Contains the actual flux measurements and padded values
10# 2. sequence_mask: binary tensor, shape [batch_size, sequence_length]
11# - 1 indicates real flux values
12# - 0 indicates padded positions
13input_features, sequence_mask = load_data()
14
15# Example of expected tensor shapes and values:
16# input_features = torch.tensor([
17# [1.2, 1.5, 1.1, nan, nan], # nan are padded values
18# [1.3, 1.4, 1.6, 1.2, 1.1] # all real values
19# ])
20# sequence_mask = torch.tensor([
21# [1, 1, 1, 0, 0], # last 2 positions are padded
22# [1, 1, 1, 1, 1] # no padding
23# ])
24
25logits = model(input_features, sequence_mask)
26
27# Apply a threshold to get binary predictions
28threshold = 0.5
29predictions = (logits > threshold).float()
30
31# Implement your own post-processing logic to reduce false positives
32# The post-processing step is crucial for:
33# 1. Filtering out noise and spurious detections
34# 2. Merging nearby detections
35# 3. Applying additional threshold or rule-based filtering
36#
37# Example post-processing strategies:
38# - Apply minimum duration threshold
39# - Merge events that are too close in time
40# - Consider the amplitude of the detected events
41# - Use domain knowledge to validate detections
42final_results = post_process_predictions(predictions)
43
44# Example implementation:
45# def post_process_predictions(predictions):
46# # Apply minimum duration filter
47# # Remove detections shorter than X minutes
48# # Merge events within Y minutes of each other
49# # Apply additional validation rules
50# return processed_results1from transformers import pipeline
2
3flare_detector = pipeline("flare-detection", model="Maxwell-Jia/fcn4flare")
4# Only surport for Kepler/K2 light curves now.
5results = flare_detector([
6 "Path/to/your/lightcurve.fits",
7 "Path/to/your/lightcurve.fits",
8 ...
9])
10
11print(results)1@article{jia2024fcn4flare,
2 title={FCN4Flare: Fully Convolution Neural Networks for Flare Detection},
3 author={Minghui Jia, A-Li Luo, Bo Qiu},
4 journal={arXiv preprint arXiv:2407.21240},
5 year={2024}
6}