Ok, that points to graphics card as culprit.
So the only change you made was the factory reset. Did you update all the various hardware drivers after this, preferably from the part manufacturer's site?
Obvious one is AMD for the Radeon driver, update that if you haven't.
Also, get Windows up-to-date.
If that doesn't fix it, then do the other drivers—motherboard chipset, sound, network etc—sometimes an apparently unrelated part can cause trouble for other parts.
I don't know if the BIOS could cause this, but update it also.
What happens if you boot into Safe Mode?
Look in Device Manager for any yellow warning icons—expand sections to see individual components.
Check Reliability Monitor and/or Event Viewer for any warnings around the times of the problem happening.
If you're still in trouble, then the hardware experts here—I'm not one—will probably need more info, see here:
Crashing to desktop? Can't connect to server? Losing cognitive function as you furiously restart a game over and over again? Look no further than the troubleshooting section for all your needs. This sub is dedicated to finding fixes to those problems taking a bite out of your gaming time and...
forums.pcgamer.com
PS Welcome to the forum