6. The maximum value of the function $f(x)=\cos 2x+2|\sin x|$ is $\qquad$ .
6. $\frac{3}{2}$.

According to the problem, we have
$$
\begin{array}{l}
f(x)=1-2 \sin ^{2} x+2|\sin x| \\
=-2\left(|\sin x|-\frac{1}{2}\right)^{2}+\frac{3}{2} .
\end{array}
$$

Since $|\sin x| \in[0,1]$, when $|\sin x|=\frac{1}{2}$, $f(x)$ achieves its maximum value $\frac{3}{2}$.