diff --git a/README.md b/README.md index 1c1eee0..2491324 100644 --- a/README.md +++ b/README.md @@ -1,99 +1,84 @@ -# Deep-tempest 2023 +# Deep-tempest: Using Deep Learning to Eavesdrop on HDMI from its Unintended Electromagnetic Emanations -Este trabajo corresponde al Proyecto de Fin de Carrera titulado *deep-tempest* de la carrera Ingeniería Eléctrica para la Facultad de Ingeniería de la Universidad de la República. +## Summary -Integrantes: -- Santiago Fernández -- Emilio Martínez -- Gabriel Varela +The [**gr-tempest**](https://github.com/git-artes/gr-tempest) project (*monitor image espionage in GNU Radio*) is extended using *deep learning* to improve the quality of the spied images. The main goal is to recover the text present in the image captured by the espionage system. -Tutores: -- Federico La Rocca -- Pablo Musé +## Data -## Resumen +The data used can be found in [this link](https://www.dropbox.com/scl/fi/7r2o8nbws45q30j5lkxjb/deeptempest_dataset.zip?rlkey=w7jvw275hu8tsyflgdkql7l1c&st=e8rdldz0&dl=0) within a ZIP file (~7GB). After unzipping, you will find synthetic and captured images used for experiments, training, and evaluation during the work. -Se extiende el proyecto [**gr-tempest**](https://github.com/git-artes/gr-tempest) (*espionaje a imágenes de monitores en GNU Radio*) utilizando *deep learning* para mejorar la calidad de las imágenes espiadas. El objetivo principal es recuperar el texto presente en la imagen capturada por el sistema espía. +The structure of the directories containing the data is **different** for **synthetic data** compared to **captured data**: +### Synthetic data -## Resultados - - - -Se evalúan las métricas **PSNR**, **SSIM**, **edgeJaccard** (*índice Jaccard entre los bordes de la referencia y de la reconstrucción*), **CER** y **WER** (*tasa de error en caracteres y palabras*) sobre la base de datos de capturas reales (1302 imágenes) son los de la siguiente tabla: - - - -Más ejemplos se pueden ver en el directorio [deep-tempest_ejemplos](deep-tempest_ejemplos). - -También se pueden visualizar desde [este enlace](https://finguy-my.sharepoint.com/:f:/g/personal/emilio_martinez_fing_edu_uy/Eo_2mmNwq0lHguqmzjq7MyABb9pBbuDV3_EPOA9xGC-7vg?e=kevSbM) *(no estable)*. Aquí las imágenes están estructuradas con el siguiente orden: - -1. Imagen original -2. Imagen espiada (_gr-tempest2.0_) -3. Imagen inferida por método _End-to-End_ -4. Imagen inferida por método de _umbralización por máxima entropía_ - -## Datos - -Los datos utilizados [este enlace](https://finguy-my.sharepoint.com/:u:/g/personal/emilio_martinez_fing_edu_uy/EZ8KpQHJ7GZBvMRsBMtNj6gBkC3Fvivuz87-1fiQS6WKiw?e=LVjajm) dentro de un archivo ZIP (~7GB). Al descomprimirlo se pueden encontrar las imágenes sintéticas y capturadas realizadas para los experimentos, entrenamiento y evaluación durante el trabajo. - -La **estructura** de los directorios es **diferente** para los **datos sintéticos** es diferente al de los **capturados**: - -### Datos sintéticos - -* *ground-truth* (directorio con imágenes de referencia/vistas del monitor) - - imagen1.png +* *ground-truth* (directory with reference/monitor view images) + - image1.png - ... - - imagenN.png + - imageN.png -* *simulations* (directorio con imágenes sintéticas de degradación/captura) - - imagen1.png +* *simulations* (directory with synthetic degradation/capture images) + - image1_synthetic.png - ... - - imagenN.png + - imageN_synthetic.png -### Datos reales +### Real data -* *Imagen 1* (directorio con capturas de imagen1.png) - - captura1_imagen1.png +- image1.png (*image1 ground-truth*) +- ... +- imageN.png (*imageN ground-truth*) + +* *Image 1* (directory with captures of *image1.png*) + - capture1_image1.png - ... - - capturaM_imagen1.png + - captureM_image1.png * ... -* *Imagen N* (directorio con capturas de imagenN.png) - - captura1_imagenN.png +* *Image N* (directory with captures of *image1.png*) + - capture1_imageN.png - ... - - capturaM_imagenN.png + - captureM_imageN.png -- imagen1.png -- ... -- imagenN.png +## Code and Requirements -## Código y requerimientos - -Clonar el repositorio (solicitar acceso al mismo): +Clone the repository: ```shell -git clone https://gitlab.fing.edu.uy/jorge.varela/deep-tempest.git +git clone https://github.com/emidan19/deep-tempest.git ``` -En cada una de los directorios se tiene una guía de cómo ejecutar las pruebas/entrenamiento/experimentos correspondientes. +Both [gr-tempest](./gr-tempest/) and [end-to-end](./end-to-end/) folders contains a guide on how to execute the corresponding files for image capturing, inference and train the deep learning architecture based on DRUNet from [KAIR](https://github.com/cszn/KAIR/tree/master) image restoration repository. -El código esta escrito en lenguaje Python versión 3.10, donde se utilizó ambientes de Anaconda. Para replicar el ambiente de trabajo crear uno nuevo con las bibliotecas del _requirements.txt_: +The code is written in Python version 3.10, using Anaconda environments. To replicate the working environment, create a new one with the libraries listed in [*requirements.txt*](./requirements.txt): ```shell conda create --name deeptempest --file requirements.txt ``` -Activarlo con: +Activate it with: ```shell conda activate deeptempest ``` -## Referencias +Regarding installations with GNU Radio, **it is necessary to follow the [gr-tempest](https://github.com/git-artes/gr-tempest) instructions** (detailed below) and then run the following flowcharts that activate *hierblocks*: -- [gr-tempest](https://github.com/git-artes/gr-tempest) -- [Deep Plug and Play Image Restoration](https://github.com/cszn/DPIR/tree/master) (DPIR) -- Maxima entropía [código en Python](https://github.com/imadtoubal/Maximum-Entropy-Thresholding-Implementation-in-Python/blob/master/entropy_thresholding.ipynb) +Finally run the flowgraph [deep-tempest_example.grc](~/gr-tempest/examples/deep-tempest_example.grc) to capture the monitor images and be able to recover them with better quality. + +## References +```BibTex +@INPROCEEDINGS{larroca2022gr_tempest, + author={Larroca, Federico and Bertrand, Pablo and Carrau, Felipe and Severi, Victoria}, + booktitle={2022 Asian Hardware Oriented Security and Trust Symposium (AsianHOST)}, + title={gr-tempest: an open-source GNU Radio implementation of TEMPEST}, + year={2022}, + doi={10.1109/AsianHOST56390.2022.10022149}} + +@article{zhang2021plug, % DPIR & DRUNet & IRCNN + title={Plug-and-Play Image Restoration with Deep Denoiser Prior}, + author={Zhang, Kai and Li, Yawei and Zuo, Wangmeng and Zhang, Lei and Van Gool, Luc and Timofte, Radu}, + journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, + year={2021} +} \ No newline at end of file diff --git a/deep-tempest.png b/deep-tempest.png index c586269..7030613 100644 Binary files a/deep-tempest.png and b/deep-tempest.png differ diff --git a/end-to-end/README.md b/end-to-end/README.md index 96bda6c..42f19c1 100644 --- a/end-to-end/README.md +++ b/end-to-end/README.md @@ -1,38 +1,47 @@ -# Método End-to-End +# End-to-End Method -## Guía de uso +## Usage Guide -A modo general, las opciones a usar (carpetas de imágenes de referencia/degradadas, modelos de la red, directorio de salida, etc) se encuentran en [end-to-end/options](../end-to-end/options). +In general, the options to use (reference/degraded image folders, network models, output directory, etc.) are located in[end-to-end/options](../end-to-end/options). -### Inferencia y Evaluación +### Inference and Evaluation -Para ejecutar la inferencia se debe editar el archivo [end-to-end/options/train_drunet.json](../end-to-end/options/train_drunet.json) y, una vez hechos los cambios, ejecutar: +To run inference, you need to edit the file [end-to-end/options/train_drunet.json](../end-to-end/options/train_drunet.json) and, once the changes are made, execute: ```shell python main_test_drunet.py ``` -Este comando dará un directorio nuevo como salida con las inferencias del directorio de entrada. +This command will output a new directory with the inferences from the input directory. -Para ejecutar la evaluación de un directorio con imágenes se debe editar el archivo [end-to-end/options/evaluation.json](../end-to-end/options/evaluation.json) y, una vez hechos los cambios, ejecutar: +To evaluate a directory with images (both reference and model's inference), you need to edit the file [end-to-end/options/evaluation.json](../end-to-end/options/evaluation.json) and, once the changes are made, execute: ```shell python tempest_evaluation.py ``` -### Entrenamiento +### Training -**Nota: antes de ejecutar el siguiente comando se debe seleccionar qué tipo de datos usar para el entrenamiento** +**Note: Before executing the following command, you must select which type of data to use for training** +#### Training with Real Data + +To train with real data, the file [end-to-end/options/train_drunet.json](../end-to-end/options/train_drunet.json) must have the value __"drunet_finetune"__ in the *dataset_type* field (datasets-->train). + +#### Training with Synthetic Data + +To train with synthetic data, the file end-to-end/options/train_drunet.json](../end-to-end/options/train_drunet.json) must have the value __"drunet"__ in the *dataset_type* field (datasets-->train). + +Once the data type was selected, use the following command to train the network: ```shell python main_train_drunet.py ``` +### Generating Synthetic Captures -#### Entrenamiento con datos reales +For synthetic captured images generation, first configure the options on [tempest_simulation.json](end-to-end/options/tempest_simulation.json) file. Be sure to include the path to the folder containing the images to run the simulation of direct capturing image from the EME of a monitor. Then run the following command: -Para entrenar con datos reales, el archivo [end-to-end/options/train_drunet.json](../end-to-end/options/train_drunet.json) debe tener en el campo __dataset_type__ (datasets-->train) el valor __"drunet_finetune"__. - -#### Entrenamiento con datos sintéticos - -Para entrenar con datos sinteticos, el archivo [end-to-end/options/train_drunet.json](../end-to-end/options/train_drunet.json) debe tener en el campo __dataset_type__ (datasets-->train) el valor __"drunet"__. \ No newline at end of file +```shell +python folder_simulation.py +``` +Which outputs the synthetic captured in the specified folder. \ No newline at end of file diff --git a/end-to-end/end-to-end.png b/end-to-end/end-to-end.png index ac31df9..52c03c7 100644 Binary files a/end-to-end/end-to-end.png and b/end-to-end/end-to-end.png differ diff --git a/gr-tempest/README.md b/gr-tempest/README.md index 850c14d..e5fbaba 100644 --- a/gr-tempest/README.md +++ b/gr-tempest/README.md @@ -1,20 +1,3 @@ -# Uso de gr-tempest con deep-tempest - - - -Actualmente el único método integrado en GNU Radio es el End-to-End. - -Para cambiar el modelo a usar durante la inferencia editar el archivo [KAIR/options/test_drunet.json](../KAIR/options/test_drunet.json). - -Respecto a las instalaciones con GNU Radio, **es necesario seguir el instructivo de gr-tempest** (detallado más abajo) y luego correr los siguientes flowgraphs que activan *hierblocks*: - -- [binary_serializer.grc](~/gr-tempest/examples/binary_serializer.grc) -- [FFT_autocorrelate.grc](~/gr-tempest/examples/FFT_autocorrelate.grc) -- [FFT_crosscorrelate.grc](~/gr-tempest/examples/FFT_crosscorrelate.grc) -- [Keep_1_in_N_frames.grc](~/gr-tempest/examples/Keep_1_in_N_frames.grc) - -Finalemente correr el flowgraph [deep-tempest_example.grc](~/gr-tempest/examples/deep-tempest_example.grc) para capturar las imágenes de monitor y poder recuperarlas con una mejor calidad. - ### gr-tempest **An implementation of TEMPEST en GNU Radio.** diff --git a/resultados.png b/resultados.png deleted file mode 100644 index ea88486..0000000 Binary files a/resultados.png and /dev/null differ