UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor mleme1990
Visitor
231 Views
Registered: ‎02-11-2020

Vitis AI Segmentation Fault during Calibration

Hi,

I'm trying to calibrate a YoloV3 with custom weights and an increased input size. The calibration images get loaded correctly and after some time calibration finishes (with 'INFO: Calibration Done' printed in the terminal). Immediately after this message, a segmentation fault occurs without any further information. At this point, the vai_q_output directory only contains a temp folder with a couple of files in it.

Does someone have any idea about this?

Best
Martin

0 Kudos
6 Replies
Xilinx Employee
Xilinx Employee
199 Views
Registered: ‎03-21-2008

Re: Vitis AI Segmentation Fault during Calibration

Are you using the gpu or cpu version of the quantizer?

Can you share the terminal output during calibration.

0 Kudos
Visitor mleme1990
Visitor
156 Views
Registered: ‎02-11-2020

Re: Vitis AI Segmentation Fault during Calibration

Hi,

I'm running the vitis-ai:tools-1.0.0-gpu container.

The terminal output is as follows:

INFO: Calibrating for 50 iterations...
100% (50 of 50) |#######################################################################################################################################| Elapsed Time: 0:12:26 Time:  0:12:26
INFO: Calibration Done.
Segmentation fault (core dumped)
0 Kudos
Xilinx Employee
Xilinx Employee
121 Views
Registered: ‎03-21-2008

Re: Vitis AI Segmentation Fault during Calibration

Are you ruinning the in the Caffe or TF conda env?

Usually when I see seg faults in calibration its an issue reading the images.

Did you see any other warnings?

0 Kudos
Visitor mleme1990
Visitor
104 Views
Registered: ‎02-11-2020

Re: Vitis AI Segmentation Fault during Calibration

Hi,

I'm using the tf env (my YoloV3 model is a converted darknet model).

I previously had an error where an image could not be loaded but I resolved it (the image had a wrong format). Now all images are just jpegs and I don't see any other warnings or errors anymore. The tf model check before also finishes successfully.

Can I enable some debug flags to get additional information?

0 Kudos
Xilinx Employee
Xilinx Employee
83 Views
Registered: ‎03-21-2008

Re: Vitis AI Segmentation Fault during Calibration

Whats your input function look like. Is the image resolution getting set properly there?

0 Kudos
Visitor mleme1990
Visitor
40 Views
Registered: ‎02-11-2020

Re: Vitis AI Segmentation Fault during Calibration

Hi,

my input function is based on the examples:

def letterbox_image(image, size):
    '''resize image with unchanged aspect ratio using padding'''
    # OpenCV image shape is height, width, channels!
    ih, iw, _ = image.shape
    w, h = size
    scale = min(w/iw, h/ih)
    nw = int(iw*scale)
    nh = int(ih*scale)

    image = cv2.resize(image,(nw,nh))
    new_image = np.ones([h, w, 3], dtype=np.uint8) * 128
    #new_image = Image.new('RGB', size, (128,128,128))
    #new_image.paste(image, ((w-nw)//2, (h-nh)//2))
    loc_w = (w-nw)//2
    loc_h = (h-nh)//2
    new_image[loc_h:loc_h+nh, loc_w:loc_w+nw] = image
    return new_image

def preprocessing_fn(image, model_image_size=(416,416)):
    if model_image_size != (None, None):
        assert model_image_size[0]%32 == 0, 'Multiples of 32 required'
        assert model_image_size[1]%32 == 0, 'Multiples of 32 required'
        boxed_image = letterbox_image(image, tuple(reversed(model_image_size)))
    else:
        new_image_size = (image.width - (image.width % 32), image.height - (image.height % 32))
        boxed_image = letterbox_image(image, new_image_size)
    image_data = np.array(boxed_image, dtype='float32')
    image_data /= 255.
    return image_data


calib_image_dir = "images/"
calib_image_list = "images/tf_calib.txt"
calib_batch_size = 10
def calib_input(iter):
    images = []
    line = open(calib_image_list).readlines()
    for index in range(0, calib_batch_size):
        curline = line[iter * calib_batch_size + index]
        calib_image_name = curline.strip()
        #print('Loading image {}'.format(calib_image_name))
        image = cv2.imread(calib_image_dir + calib_image_name)  
        image = preprocessing_fn(image, model_image_size=(512,512))
        images.append(image)
    return {"inputs": images}

So the image size is 512x512 which matches my yoloV3 model (netron screenshot of the input section below)

yolov3-railsignal_frozen.pb.png

0 Kudos