does it work if you put a delay(5000) in setup before calling imu.begin()? Sometimes devices require time to start up before you talk to them.
If not - is there a physical pullup resistor on the I2C lines anywhere? If not, add one (4.7 or 10k is good), between each I2C line and 3.3v. If that fixes it, it would imply that the time during startup of the arduino before I2C is enabled (during which time the I2C lines are floating), the device interprets the random transitions of the I2C lines as a malformed attempt to communicate and gets confused.