Auto-Lama combines object detection and image inpainting to automate object removals. It is build on top of DE:TR from Facebook Research and Lama from Samsung Research. The entire process is extremely simple:
- Objects are detected using the detector.
- Masks are generated based on the bounding boxes drawn by the detector.
- The original image is sent to the inpainter along with the masks.
There are currently a few ways of generating masks:
- Masking objects with specified indices.
- Masking one main object at a time.
- Masking all other objects other than the main object.
- Use a more precise segmentation method other than bounding boxes
- Implementing a detector that has more
docker
make
conda
make build-conda-env
conda activate auto-lama
make build-env
make clean
The default config for the detector is
PARAMETERS = {
"model_name": "facebook/detr-resnet-50",
"threshold": 0.9,
"max_items": 10,
"save_destination": "./test_images",
"output_destination": "./output_images",
"max_width": 2000,
"max_height": 2000,
"resize": True,
"resize_scale": 0.75,
"excluded_objects": [91],
"image_format": "PNG",
"mask_target_items": [],
}
Please reference here for the target items that you want to mask, as the default DE:TR uses the COCO Dataset,
make detect_and_inpaint IMAGE_PATH=path/to/image
ormake detect_and_inpaint IMAGE_PATH={image_url}