A man accused of assaulting a woman and keeping her locked in a shed has been found not guilty of rape in a second trial.