Via ADB. You need install drivers and ADB (MiFlash have it), also *.img file with TWRP. Reboot phone into Fastboot, next go to folder where you installed MiFlash (usually C:\Program Files (x86)\Xiaomi\MiPhone\Google\Android), and there use follow commands in CMD with Admin rights, or make .cmd...