diff --git a/yolov5/detect.py b/yolov5/detect.py
index 719b3fd965949350ee1b3f4c3a81aaad229c8255..33b8239d9afc2bbdfc6c717faff2f5510a725d4a 100755
--- a/yolov5/detect.py
+++ b/yolov5/detect.py
@@ -103,12 +103,12 @@ def run(
     date_now = date.today().strftime("%Y%m%d")
 
     if sound:
-        name = '_'.join([project_name, 'detect', date_now, weights[0].split('/')[-3], 'conf',
+        name = '_'.join([project_name, 'detect', date_now, weights[0].split('/')[-1], 'conf',
                         str(conf_thres).replace('.','_'), str(rf), str(sampleDur), str(window),
                         str(int(window*hop)),'low',str(int(low)) if low is not None else 'None',
                         'high',str(int(high)) if high is not None else 'None',''])
     else:
-        name = '_'.join([project_name, 'detect', date_now, weights[0].split('/')[-3], 'conf',
+        name = '_'.join([project_name, 'detect', date_now, weights[0].split('/')[-1], 'conf',
                         str(conf_thres).replace('.','_'),''])
 
     print(f'\nYour train results will be saved as {name}\n')