The Truth Beam is a proof-of-concept pipeline for securely recording scenes using a projector–camera loop, anchored by cryptographic hash chaining and (optionally) validated with a simple neural forensics module. Random seeds derived from a public blockchain (e.g., RSK) generate Perlin-based structured noise, ensuring each projected frame is cryptographically bound to its preceding recording and blockchain timestamp. A simple autoencoder–GAN can then flag inconsistent emission–capture pairs. The RSK key and blockchain submission are optional—if you prefer a purely local chain, you can skip those steps. And example dataset is available in IPFS. An example hardware specification and 3D printable model of the PolieProboscis is available in the main repo.
-
Set Up Configs
- In
config.py, specify crucial parameters:- Camera serial number (
CAMERA_SERIAL) to match your hardware. - Optional RSK private key (
RSK_PRIVATE_KEY) if you want final hashes posted on RSK. If you leave it as0x..., the script will skip that step or you can setDUMMY_RUN=True.
- Camera serial number (
- Adjust resolution, loop counts, and other parameters (e.g. for training, half-resolution sizes) as needed.
- In
-
Record Representative Datasets
- Use
secure_record.pyto gather data:- Project structured noise (seeded by blockchain or local hash).
- Capture frames via camera.
- Chain each frame’s hash so any tampering breaks continuity.
- (Optionally) Submit final hash to RSK if
DUMMY_RUN=False.
- This yields one or more HDF5 files in the
saved_datasets/directory.
- Use
-
Train Neural Networks
- Collect a representative set of these HDF5 datasets and place them in
saved_datasetsor in a customtraining_datafolder. - Run
train_networks.pyto:- Train an Adversarial Autoencoder (for reconstructing emission–recording pairs).
- Train a LatentGAN on the autoencoder’s latent space, if desired (for advanced authenticity checks).
- This produces trained model files (
aae_model_latest.pth, etc.) in your current directory or whichever path you designate.
- Collect a representative set of these HDF5 datasets and place them in
-
Verify New / Novel Datasets
- Record or obtain some new test data and place them in
novel_datasets/(or specify them directly). - Run:
verify_1_perlin.pyto check the cryptographic chain and re-generate Perlin noise for MSE comparison (detect large mismatches).verify_2_recordings.pyto see difference maps, authenticity heatmaps, etc. (if you have the AE + latent models trained).
- Inspect the logs or CSV outputs for mismatch warnings, hash failures, or high error signals.
- Record or obtain some new test data and place them in
-
Interpret Results
- If everything is consistent:
- The hash chain should be unbroken (
"OK"). - Perlin MSE should remain small, indicating minimal distortion.
- The AE or latent checks should not flag large anomalies.
- The hash chain should be unbroken (
- Suspicious or tampered data typically fails these checks.
- If everything is consistent:
- Python 3.8+
- Key packages: PyTorch, PyCUDA, OpenCV, Pillow, h5py, requests, web3, blake3, etc.
- A GPU-compatible environment if you plan to use CUDA acceleration.
- Camera & TIS.py: If capturing live data, you need a camera from The Imaging Source or compatible drivers, plus tiscamera’s
TIS.py. - Optional RSK: For anchoring final hashes publicly, set up an RSK node or use a public endpoint.
Example minimal install (not exhaustive):
pip install torch torchvision pycuda opencv-python pillow h5py requests web3 blake3
Place TIS.py from tiscamera’s GitHub into your Python path or environment as needed.
-
Project + Capture
- Perlin or structured noise is derived from a blockhash (or local seed).
- The projector displays this noise on the scene.
- A co-located camera captures each frame, producing
(emission, recording)pairs.
-
Chaining & Optional Blockchain
- Each new capture is hashed with the previous hash, forming a chain that any tampering invalidates.
- The final hash can be submitted on RSK (or left local).
-
Neural Forensics
- The autoencoder tries to reconstruct valid
(emission, recording)pairs. - A latent-space GAN attempts to detect subtle forgeries or mismatches.
- Heatmaps or difference maps highlight anomalies in suspicious frames.
- The autoencoder tries to reconstruct valid
-
config.py
Main parameters: camera serial, RSK node, private key, image sizes, loop counts, and training hyperparameters. -
blockchain.py
Fetches a fresh blockhash from RSK, optionally posts final hash on-chain if you provideRSK_PRIVATE_KEY. -
data_persistence.py
Creates HDF5 files to hold(emissions, recordings, hashes). Writes metadata (initial blockhash, final hash, etc.). -
models.py
PyTorch definitions of the Adversarial Autoencoder, a Discriminator, and optional Latent Discriminator + Generator for advanced checks. -
perlin.py
GPU-accelerated Perlin noise using PyCUDA, seeded by the blockchain blockhash or cryptographic chain. -
secure_record.py
Runs the actual recording loop, retrieving a blockhash, seeding noise, projecting, capturing frames, chaining the hashes, and optionally posting the final hash to RSK. -
train_networks.py
Simplified script to train the autoencoder on(emission, recording)data, then train a latent GAN on the AE’s internal representations. -
utils.py
Contains the Blake3 hashing function, image/tensor utilities, and private-key derivation logic. -
verify_1_perlin.py
Verifies local hash chain continuity and compares stored emission with re-generated Perlin noise (MSE) to detect major tampering or mismatch. -
verify_2_recordings.py
Uses the trained AE/latent models to produce difference maps and authenticity scores. If data is consistent, errors remain small; anomalies appear in the heatmaps.
Truth Beam™ is trademarked, and the technology has patents pending. Patent licenses will be granted for research and personal use.