Attention center人类注意力预测模型

联合创作 · 2023-09-26

Attention center 是一个机器学习模型,这个仓库包含:

  • 一个 TensorFlow Lite 模型,可用于预测图像的注意中心,即图像中最突出的部分所在的区域
  • 一个 Python 脚本,可用于使用注意力中心对图像进行批量编码。这可以和子模块 libjxl 一起使用,以便创建 JPEG XL 图像,这样解码图像将从由模型决定的注意中心开始。

Google Attention center 模型的一些预测实例,其中绿点是模型预测的图像注意力中心点。

如何使用

请确保你已经安装了 Python 和 Tensorflow:

  • 从 GitHub 上克隆它,包括子模块
  • 构建 libjxl,按照 libjxl repo 中给出的说明
  • 运行 encode_with_centers.py 脚本。
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}"

有以下标志:

  --[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')
浏览 1
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报