pytorch / android-demo-app

PyTorch android examples of usage in applications
1.48k stars 607 forks source link

results of objection dection on Android are very poor,but on PC they are very good #325

Open julien0220 opened 1 year ago

julien0220 commented 1 year ago

Can detect the correct class, but the probability is reduced

runing on pc, it gets 83%

image

running on android, it gets 55% Screenshot_20230626-102515_YOLOv5

NeighborhoodCoding commented 1 year ago

There are slight difference from mobile devices, but try this:

seed=2023
random.seed(seed)
numpy.random.seed(seed)
torch.manual_seed(seed)
if torch.cuda.is_available():
    torch.cuda.manual_seed(seed)
    torch.cuda.manual_seed_all(seed)  # all gpus
    torch.backends.cudnn.benchmark = False
    torch.backends.cudnn.deterministic = True
torch.use_deterministic_algorithms(True)
torch.set_default_tensor_type(torch.float32)