Tbh I'm French and bad French accent imitations legit piss me off, even if there's not any racism involved. When it comes to Asian accents it's even worse because of the racist undertones.
But yeah, unless you can imitate an accent perfectly and you're talking to a good friend, don't even try it in front of someone from that country. It's offensive and obnoxious.
Be a good person, don't do it.
Ha, and most of all, never imitate a generic "European", "African", or "Asian" accent. Those accents don't exist - we're talking about entire continents - and are 100% offensive.