It was not the first time it had happened and I only vaguely recalled how I fixed it the first time so I went searching online to find a solution. I found a number forums with people who experienced the same issue but all the fixes I tried didn't bring my contacts back.
Earlier in the day I had unexpectedly been prompted to enter my iCloud details and I clicked cancel so I suspected the issue was related to iCloud contact syncing.
In the end I was able to restore my contact by doing the following:
1. Open Settings->iCloud
|Figure 1: iPhone settings menu|
|Figure 2: iPhone iCloud menu|
|Figure 3: iPhone iCloud account settings|
5. Turn off your contact syncing
|Figure 4: iPhone iCloud contacts sync option|
7. Finally open your contacts and check if they have come back. If the contacts list is still empty try clicking the refresh icon in the top left of the screen
With any luck after following these steps your contacts will have returned.