-
To use any model with the partition, set the
strategytohi_resas shown above. -
To maintain the consistency between the
unstructuredandunstructured-apilibraries, we are deprecating themodel_nameparameter. Please usehi_res_model_nameparameter when specifing a model.
-
detectron2_onnxis a Computer Vision model by Facebook AI that provides object detection and segmentation algorithms with ONNX Runtime. It is the fastest model with thehi_resstrategy. -
yoloxis a single-stage real-time object detector that modifies YOLOv3 with a DarkNet53 backbone. -
yolox_quantized: runs faster than YoloX and its speed is closer to Detectron2. -
chipper(beta version): the Chipper model is Unstructured’s in-house image-to-text model based on transformer-based Visual Document Understanding (VDU) models.
Using a Non-Default Model
Unstructured will download the model specified in UNSTRUCTURED_HI_RES_MODEL_NAME environment variable. If not defined, it will download the default model.
There are three ways you can use the non-default model as follows:
- Store the model name in the environment variable
- Pass the model name in the
partitionfunction.
- Use unstructured-inference library.
Bring Your Own Models
Utilizing Layout Detection Model Zoo In the LayoutParser library, you can use various pre-trained models available in the model zoo for document layout analysis. Here’s a guide on leveraging this feature using theUnstructuredDetectronModel class in unstructured-inference library.
The UnstructuredDetectronModel class in unstructured_inference.models.detectron2 uses the faster_rcnn_R_50_FPN_3x model pretrained on DocLayNet. But any model in the model zoo can be used by using different construction parameters. UnstructuredDetectronModel is a light wrapper around the LayoutParser’s Detectron2LayoutModel object, and accepts the same arguments.
Using Your Own Object Detection Model
To seamlessly integrate your custom detection and extraction models into unstructured_inference pipeline, start by wrapping your model within the UnstructuredObjectDetectionModel class. This class acts as an intermediary between your detection model and Unstructured workflow.
Ensure your UnstructuredObjectDetectionModel subclass incorporates two vital methods:
-
The
predictmethod, which should be designed to accept aPIL.Image.Imagetype and return a list ofLayoutElements, facilitating the communication of your model’s results. -
The
initializemethod is essential for loading and prepping your model for inference, guaranteeing its readiness for any incoming tasks.

