def _load_version(cls, state, version): """ A function to load a previously saved ImageClassifier instance. """ _tkutl._model_version_check(version, cls._PYTHON_IMAGE_CLASSIFIER_VERSION) from turicreate.toolkits.classifier.logistic_classifier import LogisticClassifier state['classifier'] = LogisticClassifier(state['classifier']) state['classes'] = state['classifier'].classes # Correct models saved with a previous typo if state['model'] == "VisionFeaturePrint_Screen": state['model'] = "VisionFeaturePrint_Scene" # Load pre-trained model & feature extractor model_name = state['model'] if model_name == "VisionFeaturePrint_Scene" and _mac_ver() < (10, 14): raise ToolkitError( "Can not load model on this operating system. This model uses VisionFeaturePrint_Scene, " "which is only supported on macOS 10.14 and higher.") state[ 'feature_extractor'] = _image_feature_extractor._create_feature_extractor( model_name) state['input_image_shape'] = tuple( [int(i) for i in state['input_image_shape']]) return ImageClassifier(state)
def _load_version(self, state, version): from turicreate.toolkits.classifier.logistic_classifier import ( LogisticClassifier, ) state["classifier"] = LogisticClassifier(state["classifier"]) state = _PythonProxy(state) return TextClassifier(state)
def _load_version(cls, state, version): """ A function to load a previously saved ImageClassifier instance. """ _tkutl._model_version_check(version, cls._PYTHON_IMAGE_CLASSIFIER_VERSION) from turicreate.toolkits.classifier.logistic_classifier import LogisticClassifier state['classifier'] = LogisticClassifier(state['classifier']) state['classes'] = state['classifier'].classes # Load pre-trained model & feature extractor ptModel = _pre_trained_models.MODELS[state['model']]() feature_extractor = _image_feature_extractor.MXFeatureExtractor(ptModel) state['feature_extractor'] = feature_extractor state['input_image_shape'] = tuple([int(i) for i in state['input_image_shape']]) return ImageClassifier(state)
def _load_version(self, state, version): from turicreate.toolkits.classifier.logistic_classifier import LogisticClassifier state['classifier'] = LogisticClassifier(state['classifier']) state = _PythonProxy(state) return SentenceClassifier(state)