Hello, 

I have an error in my python script "Process finished with exit code 139 
(interrupted by signal 11: SIGSEGV)" when I run it. I have it at line 96 
(Sampext) when I try to run all processes one after the other. When I run 
the Sampext separately, it run fine. I also have it in line 97 (TrainRF).

I googled the error and understand this is a memory issue, but how do I 
solve it?

Thank you in advance

Regards,
Natalie

----------------------
OS:                  Ubuntu 16.04 LTS 64-bit
Memory:           3.7GB
Processor:        Intel Core i5 CPU M 560 @2.67GHz x4
Scripter:           PyCharm
OTB version:    5.8.0
Image size:      7.8 MB

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to otb-users@googlegroups.com
To unsubscribe from this group, send email to
otb-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to otb-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#-------------------------------------------------------------------------------
# Name:        Test .py
# Purpose:     To test the use of otb 
#
# Author:      Natalie
#
# Created:     03/05/2017
# Copyright:   (c) Natalie 2017
# Licence:     <your licence>
#-------------------------------------------------------------------------------

import otbApplication
import os

#---------STRINGS-PATHS----------------------------------------------------------
triadi = r"/media/natalie/Windows/Users/Natalie/Dropbox/ATM_auth_pgp/THESIS/Data/Dimou/2007/20072.tif"
triadindvi = r"/media/natalie/Windows/Users/Natalie/Dropbox/ATM_auth_pgp/THESIS/Files/Indices/ndvitest.tif"
triadivec = r"/media/natalie/Windows/Users/Natalie/Dropbox/ATM_auth_pgp/THESIS/Files/Classifications/samptriad2.shp"
triadifolder = r"/media/natalie/Windows/Users/Natalie/Dropbox/ATM_auth_pgp/THESIS/Files/Classifications/triadi/"

#----------NDVI---------------------------------------------------(OK)----------
def Ndvi(input, out):
    '''NDVI image with red channel=3, nir channel=4'''
    ndvi = otbApplication.Registry.CreateApplication("RadiometricIndices")
    ndvi.IN = input
    ndvi.OUT = out
    ndvi.CHANNELS.RED = 3
    ndvi.CHANNELS.NIR = 4
    ndvi.SetParameterStringList("list", ["Vegetation:NDVI"])
    ndvi.ExecuteAndWriteOutput()

#----------CLASSIFICATION-------------------------------------------------------

#----------1. Polygon Class Statistics----------------------------(OK)--------------
def Pcs(input, vec, workfolder):
    pcs = otbApplication.Registry.CreateApplication('PolygonClassStatistics')
    pcs.IN = input
    pcs.VEC = vec
    pcs.FIELD = "cl"
    pcs.OUT = workfolder + r"1samples.xml"
    pcs.ExecuteAndWriteOutput()

# ----------2. Select Samples----------------------------------(OK)------------------
def Sampsel(input, vec, workfolder):
    sampsel = otbApplication.Registry.CreateApplication("SampleSelection")
    sampsel.IN = input
    sampsel.VEC = vec
    sampsel.FIELD = "cl"
    # sampsel.STRATEGY = "constant"
    sampsel.SetParameterString("strategy", "smallest")
    sampsel.INSTATS = workfolder + r"1samples.xml"
    sampsel.OUT = workfolder + r"2sampselect.shp"
    sampsel.ExecuteAndWriteOutput()

# ----------3. Sample Extraction----------------------------------------------------
def Sampext(input, workfolder):
    sampext = otbApplication.Registry.CreateApplication("SampleExtraction")
    sampext.IN = input
    sampext.VEC = workfolder + r"2sampselect.shp"
    sampext.FIELD = "cl"
    sampext.SetParameterString("outfield", "prefix")
    sampext.SetParameterString("outfield.prefix.name", "band_")
    sampext.ExecuteAndWriteOutput()

# ----------4. Compute Image Statistics----------------------------------------------
def Imstats(input, workfolder):
    imstats = otbApplication.Registry.CreateApplication("ComputeImagesStatistics")
    imstats.IN = input
    imstats.OUT = workfolder + r"4imstatistics.xml"
    imstats.ExecuteAndWriteOutput()

# ----------5. Train classifier----------------------------------------------------
def TrainRF(workfolder):
    trainrf = otbApplication.Registry.CreateApplication("TrainVectorClassifier")
    # trainrf.IO.VD = [workfolder + r"2sampselect.shp"]
    trainrf.SetParameterStringList("io.vd", [workfolder + r"2sampselect.shp"])
    # trainrf.IO.STATS = workfolder + r"1samples.xml"
    trainrf.SetParameterStringList("io.stats", workfolder + r"1samples.xml")
    # trainrf.CLASSIFIER = "rf"
    trainrf.SetParameterStringList("classifier", "rf")
    # trainrf.FEAT = ["band_1", "band_2", "band_3"]
    trainrf.SetParameterStringList("feat", ["band_1", "band_2"])
    trainrf.CFIELD = "cl"
    trainrf.IO.OUT = workfolder + r"5rfmodel.txt"
    trainrf.ExecuteAndWriteOutput()

#================================================================================

print "Start"

# ----------Processes------------------------------------------------------------
Ndvi(triadi, triadindvi)
Pcs(triadi, triadivec, triadifolder)
Sampsel(triadi, triadivec, triadifolder)
# Imstats(triadi, triadifolder)
Sampext(triadi, triadifolder)
# TrainRF(triadifolder)

print "Successfull!!!"


Reply via email to