The problem is android and android_torchvision do not work well together.
implementation ‘org.pytorch:pytorch_android:1.9.0’
implementation 'org.pytorch:pytorch_android_torchvision:1.9.0'

It will error out with duplicate class.
I inspect the aar and it seems like android_torchvision has a dependency on android_lite. I am no expert on gradle or packaging, just want to provide more information that maybe related.
https://search.maven.org/artifact/org.pytorch/pytorch_android_torchvision/1.9.0/aar 6

the output of ./gradlew app:dependencies on ObjectDetection 's latest master 87c0ac738e48cab8b4afeacf45316671b2370bc9 confirms torch_vision has a dependency on android_lite.
+--- org.pytorch:pytorch_android:1.9.0
|    +--- com.facebook.fbjni:fbjni-java-only:0.0.3
|    |    \--- com.facebook.soloader:nativeloader:0.8.0
|    +--- com.facebook.soloader:nativeloader:0.8.0
|    \--- androidx.appcompat:appcompat:1.0.0 -> 1.2.0 (*)
+--- org.pytorch:pytorch_android_torchvision:1.9.0
|    +--- org.pytorch:pytorch_android_lite:1.9.0
|    |    +--- com.facebook.fbjni:fbjni-java-only:0.0.3 (*)
|    |    +--- com.facebook.soloader:nativeloader:0.8.0
|    |    \--- androidx.appcompat:appcompat:1.0.0 -> 1.2.0 (*)
|    +--- com.facebook.soloader:nativeloader:0.8.0
|    \--- androidx.appcompat:appcompat:1.0.0 -> 1.2.0 (*)
\--- junit:junit:4.12
     \--- org.hamcrest:hamcrest-core:1.3