amazon-science / patchcore-inspection

Apache License 2.0
733 stars 149 forks source link

Support for varying size inputs #73

Open free-soellingeraj opened 1 year ago

free-soellingeraj commented 1 year ago

I got this error because I was trying to use different size inputs. Is this happening because different samples have different sizes in my dataset?

Traceback (most recent call last):
  File "bin/run_patchcore.py", line 435, in <module>
    main()
  File "/home/ec2-user/.local/lib/python3.7/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/ec2-user/.local/lib/python3.7/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/ec2-user/.local/lib/python3.7/site-packages/click/core.py", line 1689, in invoke
    return _process_result(rv)
  File "/home/ec2-user/.local/lib/python3.7/site-packages/click/core.py", line 1626, in _process_result
    value = ctx.invoke(self._result_callback, value, **ctx.params)
  File "/home/ec2-user/.local/lib/python3.7/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "bin/run_patchcore.py", line 183, in run
    segmentations, masks_gt
  File "/home/ec2-user/code/patchcore-inspection/src/patchcore/metrics.py", line 42, in compute_pixelwise_retrieval_metrics
    ground_truth_masks = np.stack(ground_truth_masks)
  File "<__array_function__ internals>", line 6, in stack
  File "/home/ec2-user/.local/lib/python3.7/site-packages/numpy/core/shape_base.py", line 426, in stack
    raise ValueError('all input arrays must have the same shape')
Sword-Warrior commented 11 months ago

Hello, I also encountered this problem. How did you ultimately solve it?