The results are presented of an extensive programme of optical and infrared imaging of radio sources in a complete subsample of the Leiden-Berkeley Deep Survey. The LBDS Hercules sample consists of 72 sources observed at 1.4 GHz, with flux densities S(1.4) >= 1.0 mJy, in a 1.2 deg^2 region of Hercules. This sample is almost completely identified in the g, r, i and K bands, with some additional data available at J and H. The magnitude distributions peak at r ~= 22 mag, K ~= 16 mag and extend down to r ~= 26 mag, K ~= 21 mag. The K-band magnitude distributions for the radio galaxies and quasars are compared with those of other radio surveys. At S(1.4) <~ 1 Jy, the K-band distribution does not change significantly with radio flux density. The sources span a broad range of colours, with several being extremely red (r-K >~ 6). Although small, this is the most optically complete sample of millijansky radio sources available at 1.4 GHz, and is ideally suited to study the evolution of the radio luminosity function out to high redshifts.