@@ -242,28 +242,26 @@ def _set_params(
242242 if overlap >= cfg .SIG_LENGTH :
243243 raise ValueError (f"Overlap must be less than { cfg .SIG_LENGTH } seconds." )
244244
245- # Custom classifier trained with the Analyzer, not arbitrary models, meaning; A a tflite model or B a raven model
246- if custom_classifier is None :
247- # TODO: does species list even make sense with Perch?
248- cfg .LATITUDE , cfg .LONGITUDE , cfg .WEEK = lat , lon , week
249- cfg .CUSTOM_CLASSIFIER = None
250-
251- if cfg .LATITUDE == - 1 and cfg .LONGITUDE == - 1 :
252- if not slist :
253- cfg .SPECIES_LIST_FILE = None
254- else :
255- cfg .SPECIES_LIST_FILE = slist
256-
257- if os .path .isdir (cfg .SPECIES_LIST_FILE ):
258- cfg .SPECIES_LIST_FILE = os .path .join (cfg .SPECIES_LIST_FILE , "species_list.txt" )
245+ cfg .CUSTOM_CLASSIFIER = custom_classifier # we treat this as absolute path, so no need to join with dirname
246+ cfg .LATITUDE , cfg .LONGITUDE , cfg .WEEK = lat , lon , week
259247
260- cfg .SPECIES_LIST = read_lines (cfg .SPECIES_LIST_FILE , trim = True , fail_on_blank_lines = True )
261- else :
248+ # TODO: Should really be None instead of -1
249+ if cfg .LATITUDE == - 1 and cfg .LONGITUDE == - 1 :
250+ if not slist :
262251 cfg .SPECIES_LIST_FILE = None
263- cfg .SPECIES_LIST = get_species_list (cfg .LATITUDE , cfg .LONGITUDE , cfg .WEEK , cfg .LOCATION_FILTER_THRESHOLD )
252+ else :
253+ cfg .SPECIES_LIST_FILE = slist
254+
255+ if os .path .isdir (cfg .SPECIES_LIST_FILE ):
256+ cfg .SPECIES_LIST_FILE = os .path .join (cfg .SPECIES_LIST_FILE , "species_list.txt" )
257+
258+ cfg .SPECIES_LIST = read_lines (cfg .SPECIES_LIST_FILE , trim = True , fail_on_blank_lines = True )
264259 else :
265- cfg .CUSTOM_CLASSIFIER = custom_classifier # we treat this as absolute path, so no need to join with dirname
260+ # TODO: What if only one of the two is given?
261+ cfg .SPECIES_LIST_FILE = None
262+ cfg .SPECIES_LIST = get_species_list (cfg .LATITUDE , cfg .LONGITUDE , cfg .WEEK , cfg .LOCATION_FILTER_THRESHOLD )
266263
264+ if custom_classifier :
267265 if custom_classifier .endswith (".tflite" ):
268266 cfg .LABELS_FILE = custom_classifier .replace (".tflite" , "_Labels.txt" ) # same for labels file
269267
0 commit comments