공지사항 :
2025년 4월 15일 전에 Earth Engine 사용을 위해 등록된 모든 비상업용 프로젝트는 Earth Engine 액세스를 유지하기 위해
비상업용 자격 요건을 인증 해야 합니다.
의견 보내기
Export.classifier.toAsset
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
ee.Classifier를 Earth Engine 애셋으로 내보내는 일괄 태스크를 만듭니다.
ee.Classifier.smileRandomForest, ee.Classifier.smileCart, ee.Classifier.DecisionTree, ee.Classifier.DecisionTreeEnsemble에만 지원됩니다.
사용 반환 값 Export.classifier.toAsset(classifier, description , assetId , priority )
인수 유형 세부정보 classifier
ComputedObject 내보낼 분류기입니다. description
문자열(선택사항) 사람이 읽을 수 있는 태스크 이름입니다. 기본값은 'myExportClassifierTask'입니다. assetId
문자열(선택사항) 대상 확장 소재 ID입니다. priority
숫자(선택사항) 프로젝트 내 작업의 우선순위입니다. 우선순위가 높은 작업은 더 빨리 예약됩니다. 0에서 9999 사이의 정수여야 합니다. 기본값은 100입니다.
예
코드 편집기 (JavaScript)
// First gather the training data for a random forest classifier.
// Let's use MCD12Q1 yearly landcover for the labels.
var landcover = ee . ImageCollection ( 'MODIS/061/MCD12Q1' )
. filterDate ( '2022-01-01' , '2022-12-31' )
. first ()
. select ( 'LC_Type1' );
// A region of interest for training our classifier.
var region = ee . Geometry . BBox ( 17.33 , 36.07 , 26.13 , 43.28 );
// Training features will be based on a Landsat 8 composite.
var l8 = ee . ImageCollection ( 'LANDSAT/LC08/C02/T1' )
. filterBounds ( region )
. filterDate ( '2022-01-01' , '2023-01-01' );
// Draw the Landsat composite, visualizing true color bands.
var landsatComposite = ee . Algorithms . Landsat . simpleComposite ({
collection : l8 ,
asFloat : true
});
Map . addLayer ( landsatComposite , {
min : 0 ,
max : 0.3 ,
bands : [ 'B3' , 'B2' , 'B1' ]
}, 'Landsat composite' );
// Make a training dataset by sampling the stacked images.
var training = landcover . addBands ( landsatComposite ). sample ({
region : region ,
scale : 30 ,
// With export to Classifier we can bump this higher to say 10,000.
numPixels : 1000
});
var classifier = ee . Classifier . smileRandomForest ({
// We can also increase the number of trees higher to ~100 if needed.
numberOfTrees : 3
}). train ({ features : training , classProperty : 'LC_Type1' });
// Create an export classifier task to run.
var assetId = 'projects/<project-name>/assets/<asset-name>' ; // <> modify these
Export . classifier . toAsset ({
classifier : classifier ,
description : 'classifier_export' ,
assetId : assetId
});
// Load the classifier after the export finishes and visualize.
var savedClassifier = ee . Classifier . load ( assetId )
var landcoverPalette = '05450a,086a10,54a708,78d203,009900,c6b044,dcd159,' +
'dade48,fbff13,b6ff05,27ff87,c24f44,a5a5a5,ff6d4c,69fff8,f9ffa4,1c0dff' ;
var landcoverVisualization = {
palette : landcoverPalette ,
min : 0 ,
max : 16 ,
format : 'png'
};
Map . addLayer (
landsatComposite . classify ( savedClassifier ),
landcoverVisualization ,
'Upsampled landcover, saved' );
Python 설정
Python API 및 대화형 개발을 위한 geemap
사용에 관한 자세한 내용은
Python 환경 페이지를 참고하세요.
import ee
import geemap.core as geemap
Colab (Python)
# First gather the training data for a random forest classifier.
# Let's use MCD12Q1 yearly landcover for the labels.
landcover = ( ee . ImageCollection ( 'MODIS/061/MCD12Q1' )
. filterDate ( '2022-01-01' , '2022-12-31' )
. first ()
. select ( 'LC_Type1' ))
# A region of interest for training our classifier.
region = ee . Geometry . BBox ( 17.33 , 36.07 , 26.13 , 43.28 )
# Training features will be based on a Landsat 8 composite.
l8 = ( ee . ImageCollection ( 'LANDSAT/LC08/C02/T1' )
. filterBounds ( region )
. filterDate ( '2022-01-01' , '2023-01-01' ))
# Draw the Landsat composite, visualizing true color bands.
landsatComposite = ee . Algorithms . Landsat . simpleComposite (
collection = l8 , asFloat = True )
Map = geemap . Map ()
Map # Render the map in the notebook.
Map . addLayer ( landsatComposite , {
'min' : 0 ,
'max' : 0.3 ,
'bands' : [ 'B3' , 'B2' , 'B1' ]
}, 'Landsat composite' )
# Make a training dataset by sampling the stacked images.
training = landcover . addBands ( landsatComposite ) . sample (
region = region ,
scale = 30 ,
# With export to Classifier we can bump this higher to say 10,000.
numPixels = 1000
)
# We can also increase the number of trees higher to ~100 if needed.
classifier = ee . Classifier . smileRandomForest (
numberOfTrees = 3 ) . train ( features = training , classProperty = 'LC_Type1' )
# Create an export classifier task to run.
asset_id = 'projects/<project-name>/assets/<asset-name>' # <> modify these
ee . batch . Export . classifier . toAsset (
classifier = classifier ,
description = 'classifier_export' ,
assetId = asset_id
)
# Load the classifier after the export finishes and visualize.
savedClassifier = ee . Classifier . load ( asset_id )
landcover_palette = [
'05450a' , '086a10' , '54a708' , '78d203' , '009900' ,
'c6b044' , 'dcd159' , 'dade48' , 'fbff13' , 'b6ff05' ,
'27ff87' , 'c24f44' , 'a5a5a5' , 'ff6d4c' , '69fff8' ,
'f9ffa4' , '1c0dff' ]
landcoverVisualization = {
'palette' : landcover_palette ,
'min' : 0 ,
'max' : 16 ,
'format' : 'png'
}
Map . addLayer (
landsatComposite . classify ( savedClassifier ),
landcoverVisualization ,
'Upsampled landcover, saved' )
의견 보내기
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스 에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스 에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책 을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-03-20(UTC)
의견을 전달하고 싶나요?
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-03-20(UTC)"],[[["Exports an Earth Engine classifier as an asset for later use."],["Allows customization of the export task with description, asset ID, and priority settings."],["Provides code examples in JavaScript and Python demonstrating the export and subsequent use of the saved classifier."],["Utilizes a Landsat-based composite and MODIS landcover data for training the classifier in the examples."],["Enables efficient saving and loading of trained classifiers within the Earth Engine platform."]]],["This content details exporting an `ee.Classifier` as an Earth Engine asset using `Export.classifier.toAsset`. Key actions include: creating a classifier, defining a training dataset using landcover data and Landsat composites, sampling training data, and then training the classifier. The export process involves specifying the `classifier`, `description`, `assetId`, and `priority`. After export, the saved classifier can be loaded and used for classification, then visualized.\n"]]