> For the complete documentation index, see [llms.txt](https://facegsm.gitbook.io/facegsm-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://facegsm.gitbook.io/facegsm-documentation/facegsm/usage/live-mode.md).

# Live Mode

## Description

**Live mode** in FaceGSM offer real-time targeted adversarial attack FGSM using live feed input from user.

* By default, **live mode** will classify face that detected in live feed and **does not** executes the adversarial attack FGSM.
* User can trigger the **attack mode** by pressing the `a` key from user's keyboard.
* If user press `a` key after triggering the **attack mode**, FaceGSM will revert to **classify faces**.&#x20;

<figure><img src="/files/rJVMm0NI70gXHfNOArA2" alt=""><figcaption><p>Live Mode Program Flow</p></figcaption></figure>

## How To

1. Install [**Droidcam**](https://play.google.com/store/apps/details?id=com.dev47apps.droidcam\&hl=en) on your Android device and copy the **Droidcam IP address** (this IP address would be used as host for camera input).

<figure><img src="/files/6h5GN0gRDkDxWdkBG9vo" alt="" width="563"><figcaption><p>Droidcam IP Address</p></figcaption></figure>

2. Run `server.py`
3. Simultaneously, run `facegsm.py live --host [ip_droidcam] --target ./path/to/target.png` in different terminal
4. Place the camera pointed to the user's face
5. Press the `a` key to trigger the `Attack Mode`
6. The attack process will begin and FaceGSM will return the prediction to user's interface
7. User can quit the program by pressing the `q` key on the user's interface

## Example

`server.py:`

<pre class="language-bash"><code class="lang-bash"><strong>$ python3 server.py
</strong>
Server started...
</code></pre>

`facegsm.py:`

```bash
$ python3 facegsm.py live --host https://127.0.0.1:4747/video --target ./targets/john.png
```

## Demo

A demonstration of the capture mode can be seen here: [FaceGSM Live Mode Demo](https://binusianorg-my.sharepoint.com/personal/clintswood_binus_ac_id/_layouts/15/guestaccess.aspx?share=EWRcbIaRYkpNgOoEgD4ONAIB9XqDKjzqik4jR-39m4_0fQ\&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJPbmVEcml2ZUZvckJ1c2luZXNzIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXciLCJyZWZlcnJhbFZpZXciOiJNeUZpbGVzTGlua0NvcHkifX0\&e=2gTKMB)
