Open halqadasi opened 5 months ago
Hi @halqadasi, thank you for reporting the issue. Could you run the following script in the Script Editor in QuPath to check the size of the image to be sent to the server? If you are using a high-resolution display, the image size may become larger than expected. If you encounter this problem, please try lowering the screen resolution to see if it fixes the issue.
import org.elephant.sam.Utils
import qupath.lib.awt.common.AwtTools
def viewer = getCurrentViewer()
def renderedServer = Utils.createRenderedServer(viewer)
def region = AwtTools.getImageRegion(viewer.getDisplayedRegionShape(), viewer.getZPosition(),
viewer.getTPosition());
def viewerRegion = RegionRequest.createInstance(renderedServer.getPath(), viewer.getDownsampleFactor(),
region);
viewerRegion = viewerRegion.intersect2D(0, 0, renderedServer.getWidth(), renderedServer.getHeight())
def img = renderedServer.readRegion(viewerRegion)
println "Image size processed on the server: (" + img.getWidth() + ", " + img.getHeight() + ")"
Hi @halqadasi, thank you for reporting the issue. Could you run the following script in the Script Editor in QuPath to check the size of the image to be sent to the server? If you are using a high-resolution display, the image size may become larger than expected. If you encounter this problem, please try lowering the screen resolution to see if it fixes the issue.
import org.elephant.sam.Utils import qupath.lib.awt.common.AwtTools def viewer = getCurrentViewer() def renderedServer = Utils.createRenderedServer(viewer) def region = AwtTools.getImageRegion(viewer.getDisplayedRegionShape(), viewer.getZPosition(), viewer.getTPosition()); def viewerRegion = RegionRequest.createInstance(renderedServer.getPath(), viewer.getDownsampleFactor(), region); viewerRegion = viewerRegion.intersect2D(0, 0, renderedServer.getWidth(), renderedServer.getHeight()) def img = renderedServer.readRegion(viewerRegion) println "Image size processed on the server: (" + img.getWidth() + ", " + img.getHeight() + ")"
The size is 1133 * 731 and I got this error on the terminal:
raise DecompressionBombError(msg)
PIL.Image.DecompressionBombError: Image size (256160025 pixels) exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.
@halqadasi the pixel size 178956970
looks larger than expected. I will investigate it further.
In the mean time, could you check if the smaller models (vit_l
, vit_b
, vit_t
) works without giving CUDA OOM error?
@halqadasi, it seems that the OOM issue was caused by an older version of dependencies. I have updated the torch dependency to the latest version in samapi v0.4.1. Please try updating the samapi server and see if the issue is solved.
While running inference tasks in the
samapi
environment, I encountered aCUDA out of memory
error, causing the application to fallback to CPU inference. This issue significantly impacts performance. I'm looking for advice on mitigating this error or any potential fixes.Environment
Steps to Reproduce
samapi
environment:source activate samapi
uvicorn samapi.main:app --workers 2
Expected Behavior
I expected the GPU to handle the inference tasks without running out of memory, allowing for faster processing times.
Actual Behavior
Received a warning/error indicating CUDA out of memory. The system defaulted to using the CPU for inference, significantly slowing down the process. The error message was:
Additional Information