def extract_all_features(im): """ Given an image (as np tensor) extract several features :param im: a np tensor 1x256x256x3 :return: lbp, rgb histogram, ycbcr histogram, ycbcr statistics, rgb statistics, sift descriptors and neural features """ im_copy = im.copy() segmented_im, mask = Segmenter.segment_image(im_copy) if np.sum(mask) == 0: raise FeatureExtractionException() rgb_hist = FeatureExtractor.extract_rgb_hist(segmented_im, mask) ycbcr_hist = FeatureExtractor.extract_ycbcr_hist(segmented_im, mask) neural = FeatureExtractor.extract_neural_features(im_copy) lbp = FeatureExtractor.compute_LBP_rgb(segmented_im, mask) ycbcr_statistics = FeatureExtractor.extract_statistics_ycbcr(segmented_im, mask) rgb_statistics = FeatureExtractor.extract_statistics_rgb(segmented_im, mask) sift_kp = FeatureExtractor.extract_sift_kp(segmented_im, mask) if sift_kp is None or len(sift_kp.shape) == 0: raise FeatureExtractionException() return lbp, rgb_hist, ycbcr_hist, ycbcr_statistics, rgb_statistics, sift_kp, neural