The efficiency to identify jets containing b -hadrons (b -jets) is measured using a high purity sample of dileptonic top quark-antiquark pairs (tt ¯ ) selected from the 36.1 fb -1 of data collected by the ATLAS detector in 2015 and 2016 from proton-proton collisions produced by the Large Hadron Collider at a centre-of-mass energy s v =13 TeV. Two methods are used to extract the efficiency from tt ¯ events, a combinatorial likelihood approach and a tag-and-probe method. A boosted decision tree, not using b -tagging information, is used to select events in which two b -jets are present, which reduces the dominant uncertainty in the modelling of the flavour of the jets. The efficiency is extracted for jets in a transverse momentum range from 20 to 300 GeV, with data-to-simulation scale factors calculated by comparing the efficiency measured using collision data to that predicted by the simulation. The two methods give compatible results, and achieve a similar level of precision, measuring data-to-simulation scale factors close to unity with uncertainties ranging from 2% to 12% depending on the jet transverse momentum.