def get_seg_ie_polys(self): d = self.dfl_dict.get('seg_ie_polys', None) if d is not None: d = SegIEPolys.load(d) else: d = SegIEPolys() return d
def __init__(self, sample_type=None, filename=None, face_type=None, shape=None, landmarks=None, ie_polys=None, seg_ie_polys=None, eyebrows_expand_mod=None, source_filename=None, person_name=None, pitch_yaw_roll=None, **kwargs): self.sample_type = sample_type if sample_type is not None else SampleType.IMAGE self.filename = filename self.face_type = face_type self.shape = shape self.landmarks = np.array(landmarks) if landmarks is not None else None self.ie_polys = IEPolys.load(ie_polys) self.seg_ie_polys = SegIEPolys.load(seg_ie_polys) self.eyebrows_expand_mod = eyebrows_expand_mod if eyebrows_expand_mod is not None else 1.0 self.source_filename = source_filename self.person_name = person_name self.pitch_yaw_roll = pitch_yaw_roll self._filename_offset_size = None
def __init__(self, sample_type=None, filename=None, face_type=None, shape=None, landmarks=None, seg_ie_polys=None, xseg_mask=None, xseg_mask_compressed=None, eyebrows_expand_mod=None, source_filename=None, person_name=None, pitch_yaw_roll=None, **kwargs): self.sample_type = sample_type if sample_type is not None else SampleType.IMAGE self.filename = filename self.face_type = face_type self.shape = shape self.landmarks = np.array(landmarks) if landmarks is not None else None if isinstance(seg_ie_polys, SegIEPolys): self.seg_ie_polys = seg_ie_polys else: self.seg_ie_polys = SegIEPolys.load(seg_ie_polys) self.xseg_mask = xseg_mask self.xseg_mask_compressed = xseg_mask_compressed if self.xseg_mask_compressed is None and self.xseg_mask is not None: xseg_mask = np.clip( imagelib.normalize_channels(xseg_mask, 1) * 255, 0, 255).astype(np.uint8) ret, xseg_mask_compressed = cv2.imencode('.png', xseg_mask) if not ret: raise Exception( "Sample(): unable to generate xseg_mask_compressed") self.xseg_mask_compressed = xseg_mask_compressed self.xseg_mask = None self.eyebrows_expand_mod = eyebrows_expand_mod if eyebrows_expand_mod is not None else 1.0 self.source_filename = source_filename self.person_name = person_name self.pitch_yaw_roll = pitch_yaw_roll self._filename_offset_size = None