summaryrefslogtreecommitdiff
path: root/megapixels/commands/cv/face_attributes.py
diff options
context:
space:
mode:
Diffstat (limited to 'megapixels/commands/cv/face_attributes.py')
-rw-r--r--megapixels/commands/cv/face_attributes.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/megapixels/commands/cv/face_attributes.py b/megapixels/commands/cv/face_attributes.py
index bb7978f7..01fe3bd1 100644
--- a/megapixels/commands/cv/face_attributes.py
+++ b/megapixels/commands/cv/face_attributes.py
@@ -77,7 +77,7 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_dir_media, opt_data_store, opt_dataset,
# -------------------------------------------------------------------------
# load filepath data
fp_record = data_store.metadata(types.Metadata.FILE_RECORD)
- df_record = pd.read_csv(fp_record, dtype={'fn':str}).set_index('index')
+ df_record = pd.read_csv(fp_record, dtype=cfg.FILE_RECORD_DTYPES).set_index('index')
# load ROI data
fp_roi = data_store.metadata(types.Metadata.FACE_ROI)
df_roi = pd.read_csv(fp_roi).set_index('index')
@@ -112,18 +112,15 @@ def cli(ctx, opt_fp_in, opt_fp_out, opt_dir_media, opt_data_store, opt_dataset,
bbox_norm = BBox.from_xywh(df_img.x, df_img.y, df_img.w, df_img.h)
bbox_dim = bbox_norm.to_dim(dim)
- #age_apnt = age_estimator_apnt.predict(im_resized, bbox_norm)
- #age_real = age_estimator_real.predict(im_resized, bbox_norm)
- #gender = gender_estimator.predict(im_resized, bbox_norm)
+ age_apnt = age_estimator_apnt.predict(im_resized, bbox_norm)
+ age_real = age_estimator_real.predict(im_resized, bbox_norm)
+ gender = gender_estimator.predict(im_resized, bbox_norm)
- # attr_obj = {
- # 'age_real':float(f'{age_real:.2f}'),
- # 'age_apparent': float(f'{age_apnt:.2f}'),
- # 'm': float(f'{gender["m"]:.4f}'),
- # 'f': float(f'{gender["f"]:.4f}'),
- # 'roi_index': roi_index
- # }
attr_obj = {
+ 'age_real':float(f'{age_real:.2f}'),
+ 'age_apparent': float(f'{age_apnt:.2f}'),
+ 'm': float(f'{gender["m"]:.4f}'),
+ 'f': float(f'{gender["f"]:.4f}'),
'roi_index': roi_index
}
results.append(attr_obj)