Пример #1
0
    def _eval(self, db_segmentation, eval_func, measure, scale=1):
        annotations = self._masks[1:-1]

        # Strip of first and last frame if available
        segmentation = db_segmentation._masks[1 - db_segmentation.
                                              _frames[0]:len(annotations) + 1 -
                                              db_segmentation._frames[0]]

        assert len(annotations) == len(segmentation)

        if measure == 'T':
            magic_number = 5.0
            X = np.array([np.nan] + [
                eval_func(an, sg) * magic_number
                for an, sg in zip(segmentation[:-1], segmentation[1:])
            ] + [np.nan])
        else:
            X = np.array([np.nan] + [
                eval_func(an, sg) for an, sg in zip(annotations, segmentation)
            ] + [np.nan])

        from utils import db_statistics
        M, O, D = db_statistics(X)

        if measure == 'T': O = D = np.nan

        return X, M, O, D
Пример #2
0
	def _eval(self,db_segmentation,eval_func,measure,scale=1):
		annotations = self._masks[1:-1]

		# Strip of first and last frame if available
		segmentation = db_segmentation._masks[
				1-db_segmentation._frames[0]:len(annotations)+1-db_segmentation._frames[0]]

		assert len(annotations) == len(segmentation)

		if measure == 'T':
			magic_number = 5.0
			X = np.array([np.nan]+[eval_func(an,sg)*magic_number for an,sg
				in zip(segmentation[:-1],segmentation[1:])] + [np.nan])
		else:
			X = np.array([np.nan]+[eval_func(an,sg) for an,sg
					in zip(annotations,segmentation)] + [np.nan])

		from utils import db_statistics
		M,O,D = db_statistics(X)

		if measure == 'T': O = D = np.nan

		return X,M,O,D