File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,24 @@ def create_data(self):
69
69
70
70
print ("Created new .data file for the loaded network." )
71
71
72
+
73
+ def update_data (self ):
74
+ """
75
+ creates a .data file in the location of the config file with the current location of the .names file and sets
76
+ the path to the output file as the new .data file.
77
+ """
78
+ with open (self .data , "r" ) as f :
79
+ lines = f .readlines ()
80
+ for l , line in enumerate (lines ):
81
+ if line .split (" " )[0 ] == "names" :
82
+ lines [l ] = "names = " + str (self .names ).replace ("\\ " , "/" ) + "\n "
83
+
84
+ with open (self .data , "w" ) as f :
85
+ for line in lines :
86
+ f .write (line )
87
+
88
+ print ("INFO: Updated .data file for the loaded network to include absolute path of .names file" )
89
+
72
90
def update_cfg (self , nw_width , nw_height , encoding = "utf-8" ):
73
91
"""
74
92
Updates the cfg file and creates a copy of it in the same directory as the original. The function updates the
Original file line number Diff line number Diff line change 30
30
"author" : "Fabian Plum" ,
31
31
"description" : "Deep learning-based multi animal tracker" ,
32
32
"blender" : (3 , 3 , 0 ),
33
- "version" : (0 , 2 , 2 ),
33
+ "version" : (0 , 2 , 3 ),
34
34
"location" : "" ,
35
35
"warning" : "RUN IN ADMINISTRATOR MODE DURING INSTALLATION!" ,
36
36
"category" : "motion capture"
@@ -262,6 +262,9 @@ def execute(self, context):
262
262
263
263
if yolo_paths .data is None :
264
264
yolo_paths .create_data ()
265
+ else :
266
+ # update the data file to ensure it points to the correct absolute location of the names file
267
+ yolo_paths .update_data ()
265
268
266
269
context .scene .detection_config_path = yolo_paths .cfg
267
270
context .scene .detection_data_path = yolo_paths .data
You can’t perform that action at this time.
0 commit comments