PeculiarVentures/GammaCV

Error with pcLines

ramiel opened this issue · 2 comments

I have this code

const sess = new gm.Session();
const input = await gm.imageTensorFromURL(
  '/image.jpg',
  'uint8',
  [width, height, 4],
  true
);

let operation = gm.grayscale(input);
operation = gm.downsample(input, 2, 'max');
operation = gm.gaussianBlur(input, 30, 1);
operation = gm.dilate(input, [3, 3]);
operation = gm.adaptiveThreshold(input, 3, 5);
operation = gm.sobelOperator(input);
operation = gm.cannyEdges(input, 0.8, 1);
operation = gm.pcLines(input, 10, 2, 2);

const output = gm.tensorFrom(operation);
sess.init(operation);
sess.runOp(operation, 0, output);

if I run this code I get the error Tensor: Shape is not valid.

If I change the output to be const output = gm.tensorFrom(input); I get the error KernelConstructor: Constant W, has invalid type "number".

None of these errors happen if I remove the pcLines call. What can be the cause?

@ramiel, thanks for pointing on this. There is an error when gm.pcLines layersCount argument (second) is too high. We will enhance the input validation soon.
For your code, you could reduce the layersCount of pcLines up to 1-3.

operation = gm.pcLines(input, 1, 2, 2);

Ok, thank you. I'll try and I'll let you know