# Artifact Images Without Background This dataset contains images of **archaeological artifacts with the background removed**. The images were generated by filtering and processing the original dataset: https://huggingface.co/datasets/archaia/dataset_v1 The following sections describe the processing pipeline used to obtain the final dataset, including: 1. Image filtering using **CLIP** 2. **Object detection and background removal** --- # Processing Pipeline ## 1. Image Filtering with CLIP The first step filters the images from the original dataset to retain only those containing archaeological artifacts. The filtering process is implemented in [`ComputeCls.py`](ComputeCls.py). ### Execution Run the following command: ```bash python ComputeCls.py --input_path [path_to_input_dir] ``` ### Output The script performs the following operations: - Classifies images using CLIP - Generates a JSON file containing classification results - Moves images classified as artifacts to a new directory - Saves visualization plots of images identified as artifacts - This step produces a filtered subset containing only artifact-related images. ## 2. Object Detection and Background Removal The second stage detects artifacts in the images and removes their backgrounds. The code is implemented in [`test_finetuned_removebg.py`](test_finetuned_removebg.py). ### Execution Run the following command: ```bash python test_finetuned_removebg.py --input_path [path_to_input_dir] --output_path [path_to_output_dir] ``` ### Processing Steps - The script iterates over each image in the input directory. - An object detection model detects potential artifacts in the image. - The detection model is a fine-tuned DETR model trained on 303 labeled images. Details about the training data and the model checkpoint will be provided in a separate repository. - Only detections labeled as "*Archaeological artifacts*" are retained. - The detected bounding boxes are used to crop the original images. - Since a single image may contain multiple artifacts, each detection is processed independently. - For every cropped artifact, the BRIAAI background removal model is applied to remove the background. ### Output - The processed images are saved in the specified output directory. - If multiple artifacts are detected in the same image, each artifact is saved separately using the following naming convention: original_filename_[detection_id].png - Example: - 000000029_0.png - 000000029_1.png - 000000029_2.png - Each output image contains a single archaeological artifact with the background removed. # Result The final dataset consists of: - Images containing individual archaeological artifacts - Background removed - Artifacts automatically extracted from the original dataset using a pipeline based on: - CLIP image filtering - DETR object detection - BRIAAI background removal