sketchkit.vectorization.DeepVecSIG24 package¶
Submodules¶
sketchkit.vectorization.DeepVecSIG24.DeepVecSIG24 module¶
- class sketchkit.vectorization.DeepVecSIG24.DeepVecSIG24.DeepVecSIG24(device: str = 'cuda')[source]¶
Bases:
objectA class for image vectorization using the method of paper “Deep Sketch Vectorization via Implicit Surface Extraction” in SIGGRAPH 2024.
- device¶
The device that is used.
- Type:
str
- _load_checkpoint_ndc(filepath)[source]¶
Loads model from a checkpoint we will need the distance threshold to accruately recover the UDF for the next NDC model
- _load_checkpoint_udf(filepath)[source]¶
Loads model from a checkpoint we will need the distance threshold to accruately recover the UDF for the next NDC model
- run(image_array: ndarray, image_folder: str = './', out_folder: str = 'svg') Sketch[source]¶
Vectorize the input raster image.
- Parameters:
image_array (numpy.ndarray) – input raster image in shape (H, W), with values in [0, 255].
image_folder (str, optional) – the folder of the input raster image.
out_folder (str, optional) – an output folder to store the output svg file.
- Returns:
a Sketch instance.
- Return type:
sketch (Sketch)
- sketchkit.vectorization.DeepVecSIG24.DeepVecSIG24.safe_torch_load(path: str, **kwargs)[source]¶
Safely loads a PyTorch checkpoint with weights_only=True.
PyTorch 2.6+ defaults to weights_only=True, which blocks some globals in checkpoints (e.g., argparse.Namespace, types.SimpleNamespace). This function keeps weights_only=True but allowlists common ones. Falls back gracefully for older torch versions.
- Parameters:
path – Path to the checkpoint file.
**kwargs – Additional keyword arguments to pass to torch.load.
- Returns:
The loaded checkpoint.
Module contents¶
- class sketchkit.vectorization.DeepVecSIG24.DeepVecSIG24(device: str = 'cuda')[source]¶
Bases:
objectA class for image vectorization using the method of paper “Deep Sketch Vectorization via Implicit Surface Extraction” in SIGGRAPH 2024.
- device¶
The device that is used.
- Type:
str
- _load_checkpoint_ndc(filepath)[source]¶
Loads model from a checkpoint we will need the distance threshold to accruately recover the UDF for the next NDC model
- _load_checkpoint_udf(filepath)[source]¶
Loads model from a checkpoint we will need the distance threshold to accruately recover the UDF for the next NDC model
- run(image_array: ndarray, image_folder: str = './', out_folder: str = 'svg') Sketch[source]¶
Vectorize the input raster image.
- Parameters:
image_array (numpy.ndarray) – input raster image in shape (H, W), with values in [0, 255].
image_folder (str, optional) – the folder of the input raster image.
out_folder (str, optional) – an output folder to store the output svg file.
- Returns:
a Sketch instance.
- Return type:
sketch (Sketch)