Let $G$ and $H$ be (nonabelian) groups, and $\varphi: G\to \text{Aut}(H)$ be a homomorphism. This defines the semidirect product $H\rtimes_{\varphi} G$. I am wondering, what is the best way to characterise how 'far away' $H\rtimes_{\varphi} G$ is from being a direct product $H\times G$?
My attempt: The product in $H\rtimes_{\varphi} G$ is $$(h_1,g_1)(h_2,g_2)=(h_1\varphi_{g_1}(h_2),g_1g_2)$$ for $h_i\in H$, $g_i\in G$. Then the semidirect product is the direct product if $\varphi_{g_1}(h_1)=h_1$ for all $g_1\in G$ and all $h_1\in H$. This is true in turn if $\text{ker}(\varphi)=G$. Since $\text{ker}(\varphi)\triangleleft G$ is a normal subgroup of $G$, we could view the quotient $G/\text{ker}(\varphi)$ as an 'obstruction group' of $H\rtimes_{\varphi} G$ being isomorphic to $H\times G$.
Question: Is there a better way to characterise the deviation from $\rtimes_\varphi$ being $\times$ (such as group cohomology), or can one make a similar statement without knowing the specific form of $\varphi$?