File size: 1,992 Bytes
811ed88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fff2865
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70a6b5b
fff2865
 
 
 
 
 
811ed88
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
tags:
- ml-intern
- radar
- electronic-warfare
- fmcw
- spoofing-detection
- prototype
---

[![Built with ML Intern](https://huggingface.co/datasets/huggingface/badges/resolve/main/built-with-ml-intern-sm.svg)](https://hf.co/chat?mode=ml-intern)

# FMCW Spoofing Detector — Prototype

Détecteur de retours radar FMCW usurpés (échos fantômes), CNN 1D PyTorch.
Reconstruction corrigée de [Ajinkya-001/An-AI-Based-FMCW-Radar-Jammer-Detector](https://github.com/Ajinkya-001/An-AI-Based-FMCW-Radar-Jammer-Detector) :
délais/atténuations chevauchants entre classes (pas de fuite d'étiquette), split **par scène** 80/10/10, 5000 signaux synthétiques (SNR 10–30 dB).

## Résultats (test, scènes non vues)

- accuracy : **0.9680**
- matrice de confusion : [[250, 0], [16, 234]]

## Inférence Rust (sans framework ML)

Le dossier [`rust/`](https://huggingface.co/secutorpro/fmcw-spoofing-detector-prototype/tree/main/rust) contient un portage complet du modèle en Rust pur :
Conv1d, MaxPool, AdaptiveAvgPool, Linear et sigmoid sont implémentés à la main — aucune dépendance ML, seulement `serde`, `serde_json` et `ureq`.

```bash
cd rust && cargo run --release
```

Le binaire télécharge `export/weights.bin` (91 652 octets, f32 LE plat) + `export/manifest.json`
depuis ce repo, exécute 4 vecteurs de test et compare ses sorties aux probabilités PyTorch
de référence (`export/test_vectors.json`) :

| Cas | Label | Rust | PyTorch |
|---|---|---|---|
| 0 | real | 0,000103 | 0,000103 |
| 1 | real | 0,001893 | 0,001893 |
| 2 | spoofed | 0,999199 | 0,999199 |
| 3 | spoofed | 0,999965 | 0,999965 |

Écart maximal observé : **4,79e-9** (tolérance 1e-4) — bit-fidèle au comportement PyTorch.
~2,2 ms par inférence sur 2 cœurs CPU (build release, rustc 1.99.1).

## Usage Python

```python
import torch
from model_stub import SpoofNet  # architecture dans model.py du repo d'origine
```

Signaux de 512 échantillons à 10 MHz (signal battue FMCW après mélange).