If, immediately after following all those ideas, you continue to have issues with RAM and CPU, then it's possible it’s simply because your software is absolutely way too heavy, as well as a Raspberry Pi is not the correct tool for the position. In such a case, it is advisable https://www.mirobot.ai/