You may want to read and digest this thread - Standalone Raspberry Pi Security Camera with AI "person detection"