Attention center is a machine learning model, this repository contains:

  • A TensorFlow Lite model that can be used to predict the center of attention of an image, that is, the area where the most prominent parts of the image are located
  • A Python script that can be used to batch encode images using attention centers. This can be used with the submodule libjxl to create JPEG XL images such that the decoded image will start at the center of attention determined by the model.

Some prediction examples of the Google Attention center model, where the green dots are the image attention centers predicted by the model.

how to use

Make sure you have installed Python and Tensorflow:

  • Clone it from GitHub, including submodules
  • Build libjxl, following the instructions given in the libjxl repo
  • Run the encode_with_centers.py script.
git clone https://github.com/google/attention-center --recursive --shallow-submodules
cd attention-center/libjxl
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF ..
cmake --build . -- -j$(nproc)
cd ../../
python encode_with_centers.py --lite_model_file=./model/center.tflite \
  --image_dir="${INPUT_IMAGE_DIR}" --output_dir="${OUTPUT_IMAGE_DIR}"

There are the following flags:

  --[no]dry_run: If true, only do a dry run, do not write files.
    (default: 'false')
  --encoder: Location of th encoder binary.
  --image_dir: Name of the directory of input images.
    (default: './libjxl/build/tools/cjxl')
  --lite_model_file: Path to the corresponding TFLite model.
  --new_suffix: File extension of the compressed file.
    (default: 'jxl')
  --output_dir: Name of the directory of the output images.
  --[no]verbose: If true, prints info about the commands executed.
    (default: 'true')

#Attention #center #Homepage #Documentation #Downloads #Human #Attention #Prediction #Model #News Fast Delivery

Leave a Comment

Your email address will not be published. Required fields are marked *