As fdb says, the middle and passive voice aren't completely identical: in two specific tenses (the future and aorist), they're distinct. For example, "I will be released" is λυθήσομαι, while "I will release myself" is λύσομαι; "I was released" is ἐλύθην, while "I released myself" is ἐλυσάμην. In these specific instances, a theta before the ending tells you that it's passive, and the lack of a theta tells you that it's middle.
In most tenses, though, the two are completely identical, and you have to rely on context to tell which is which.
In the passive, you'll often see an agent marked—"I was released by the guards". In Greek, this is represented by ὑπο plus the genitive. If you see that, you can be confident it's a passive construction.
In the middle, you'll sometimes see a direct object in the accusative (when the meaning is closer to "I did this for my own benefit" than "I did this to myself"). Passive verbs in Greek can never take direct objects, so if you see this, you can be confident it's a middle construction. However, quite a lot of middle-voice verbs won't have objects, so this is a sufficient but not necessary condition.
If neither of those holds true, and there's not a good reason to assume passive, assume the middle voice as a default. In places where English and Latin use the passive, Ancient Greek often uses the middle voice instead. It's an order of magnitude more common than the passive, and I'd imagine a native Athenian in the fifth century BCE would make the same assumption.