I saw many classifiers aim to obtain a high accuracy in deep learning. And people use different kinds of loss functions, like cross-entropy, L1, or L2 loss.
The accuracy is defined as $$ Accuracy = \frac{TP + TN}{TP + TN + FP + FN}$$
Is it possible to directly maximize the accuracy as loss function? Can we solve $$ max_\theta \qquad \text{Accuracy}(y, y')$$ directly? Here $y$ is the true label and $y'$ is the predicted value.
Two issues here. Unless you have a balanced dataset, maximising accuracy is pointless. For example, if your dataset consists of 99% negative examples and 1% positive examples, it is very easy to hit high accuracy simply by classifying all examples as negative.
Secondly, I don't think your accuracy function is differentiable. Depending on how your neural network decides it's output value, say for instance it outputs a probability then the output $y$ classification for your training input $x$ and let $\theta(x)$ be out put from your neural net is actually a piecewise function:
$$y(\theta(x))\begin{cases} 1 &\text{if } \theta(x) \geq 0.5\\ 0 &\text{otherwise}. \end{cases}$$
In other words, if one were to differentiate the function $y$ we get zero and any back propagation would be zero.