Note that the spikes point outwards and downwards

The orientation of the spikes (I was waiting outside the gate when I snapped this photo) suggests that they're intended to prevent unauthorized ingress rather than escape.
At the very least, the spikes ought to be sandblasted and repainted periodically. And stainless steel barbed wire exists.

The orientation of the spikes (I was waiting outside the gate when I snapped this photo) suggests that they’re intended to prevent unauthorized ingress rather than escape.

If I really put my mind to it, I’m sure that I could find hints in dusty old microfiche newspaper archives or historical society bulletins of why in the heck most or all schools in Hong Kong are surrounded by high walls topped with spikes and/or barbed wire.