The transistors are used as voltage controlled switches.They controll the relays by sinking current through the realy coils. The diode in parallel with the relay coil is used to protect the transistors from the inductive current when the transistor will atempt to cut off the relay current.