I assume you have unlocked your bootloader right?
In this case it is very simple
Make a backup of your data first because the process will format everything
Download and install on your PC the software "miflash tool"
Open the program and connect to your mi account
On the top left go into...