@@ -139,6 +139,7 @@ local function save_preferences()
139
139
dt .preferences .write (MODULE , " unknown_tag" , " string" , fc .unknown_tag .text )
140
140
dt .preferences .write (MODULE , " no_persons_found_tag" , " string" , fc .no_persons_found_tag .text )
141
141
dt .preferences .write (MODULE , " ignore_tags" , " string" , fc .ignore_tags .text )
142
+ dt .preferences .write (MODULE , " category_tags" , " string" , fc .category_tags .text )
142
143
dt .preferences .write (MODULE , " known_image_path" , " directory" , fc .known_image_path .value )
143
144
local val = fc .tolerance .value
144
145
val = string.gsub (tostring (val ), " ," , " ." )
@@ -153,6 +154,7 @@ local function reset_preferences()
153
154
fc .unknown_tag .text = " unknown_person"
154
155
fc .no_persons_found_tag .text = " no_persons_found"
155
156
fc .ignore_tags .text = " "
157
+ fc .category_tags .text = " "
156
158
fc .known_image_path .value = dt .configuration .config_dir .. " /face_recognition"
157
159
fc .tolerance .value = 0.6
158
160
fc .num_cores .value = - 1
@@ -203,6 +205,7 @@ local function face_recognition ()
203
205
local knownPath = dt .preferences .read (MODULE , " known_image_path" , " directory" )
204
206
local nrCores = dt .preferences .read (MODULE , " num_cores" , " integer" )
205
207
local ignoreTagString = dt .preferences .read (MODULE , " ignore_tags" , " string" )
208
+ local categoryTagString = dt .preferences .read (MODULE , " category_tags" , " string" )
206
209
local unknownTag = dt .preferences .read (MODULE , " unknown_tag" , " string" )
207
210
local nonpersonsfoundTag = dt .preferences .read (MODULE , " no_persons_found_tag" , " string" )
208
211
@@ -303,6 +306,9 @@ local function face_recognition ()
303
306
t = nonpersonsfoundTag
304
307
end
305
308
if t ~= " " and t ~= nil then
309
+ if categoryTagString ~= " " and t ~= nonpersonsfoundTag then
310
+ t = categoryTagString .. " |" .. t
311
+ end
306
312
dt .print_log (" ImgId:" .. img .id .. " Tag:" .. t )
307
313
-- Create tag if it does not exist
308
314
if tags_list [t ] == nil then
@@ -351,6 +357,12 @@ fc.ignore_tags = dt.new_widget("entry"){
351
357
editable = true ,
352
358
}
353
359
360
+ fc .category_tags = dt .new_widget (" entry" ){
361
+ text = dt .preferences .read (MODULE , " category_tags" , " string" ),
362
+ tooltip = _ (" tag category" ),
363
+ editable = true ,
364
+ }
365
+
354
366
fc .tolerance = dt .new_widget (" slider" ){
355
367
label = _ (" tolerance" ),
356
368
tooltip = (" detection tolerance - 0.6 default - lower if too many faces detected" ),
@@ -421,6 +433,8 @@ local widgets = {
421
433
fc .no_persons_found_tag ,
422
434
dt .new_widget (" label" ){ label = _ (" tags of images to ignore" )},
423
435
fc .ignore_tags ,
436
+ dt .new_widget (" label" ){ label = _ (" tag category" )},
437
+ fc .category_tags ,
424
438
dt .new_widget (" label" ){ label = _ (" face data directory" )},
425
439
fc .known_image_path ,
426
440
}
0 commit comments