12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- from paddlers.deploy import Predictor
- import numpy as np
- from PIL import Image
- import uuid
- predictor = Predictor("inference_model/building", use_gpu=True)
- def building_extract(image1,outputPath):
-
-
-
-
-
-
-
-
-
-
-
- res = predictor.predict(image1)
-
-
-
-
-
-
- cm = res['label_map']
-
- change_map_image = Image.fromarray(np.uint8(cm * 255), 'L')
-
-
-
-
-
- savePath = outputPath+str(uuid.uuid4())+'.png'
-
- change_map_image.save(savePath)
-
-
-
-
-
- return savePath
- building_extract(r'E:\building_data\remote_sensing\train\JPGImages\image_19.jpg','E:/PaddleRS/predict/output/')
|