Home Articles Books Search About
RSS 日本語
Running NDLOCR App with Google Colab (Image Input and Result Saving via Google Drive)

Running NDLOCR App with Google Colab (Image Input and Result Saving via Google Drive)

Overview Previously, I shared a method for running the NDLOCR app using Google Cloud Platform’s Compute Engine. However, the above method involves somewhat cumbersome procedures and incurs costs. While it is suitable for production environments, it presented a high barrier for small-scale or experimental use. To address this issue, @blue0620 created a method for running the NDLOCR app using Google Colab. https://twitter.com/blue0620/status/1519294332159012864 By using the above notebook, you can easily (with one click from “Runtime” > “Run all”) and freely run OCR. ...

Amazon Lightsailを用いたOmeka Sサイトの構築(独自ドメイン+SSL化を含む)

概要 Amazon Lightsail インスタンスの作成 インスタンス内での作業 ファイルの移動 データベースの作成 Omeka Sの設定 ブラウザでの設定 独自ドメインの付与 静的IPアドレスの付与 Route 53 SSL化 (参考)Basic認証 まとめ 概要 Amazon Lightsailは以下のような説明がなされています。 Amazon Lightsail は、コンテナなどのクラウドリソースを予測可能な低価格で簡単に管理できる、使いやすい仮想プライベートサーバー (VPS) です。 今回は、このAmazon Lightsailを用いたOmeka Sの構築方法を紹介します。合わせて、データベースの公開にあたり一般的に求められる「独自ドメイン」「SSL」設定についても扱います。 Amazon Lightsail インスタンスの作成 以下のページにアクセスします。 https://lightsail.aws.amazon.com/ls/webapp/home/instances そして、以下の「Create Instance」ボタンをクリックします。 「Select a blueprint」において、「LAMP (PHP 7)」を選択します。 「Choose your instance plan」において、インスタンスプランを選択します。今回は最も低価格のプランを選びました。 起動したら、以下のインスタンスのページにアクセスして、「Connect using SSH」ボタンを押します。 以下の画面が表示されます。 Linux ip-172-26-5-202 4.19.0-19-cloud-amd64 #1 SMP Debian 4.19.232-1 (2022-03-07) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. ___ _ _ _ | _ |_) |_ _ _ __ _ _ __ (_) | _ \ | _| ' \/ _` | ' \| | |___/_|\__|_|_|\__,_|_|_|_|_| *** Welcome to the LAMP packaged by Bitnami 7.4.28-14 *** *** Documentation: https://docs.bitnami.com/aws/infrastructure/lamp/ *** *** https://docs.bitnami.com/aws/ *** *** Bitnami Forums: https://community.bitnami.com/ *** bitnami@ip-172-26-5-202:~$ インスタンス内での作業 ファイルの移動 まず、必要なファイルのダウンロードや移動を行います。 ...

Building an Omeka S Site Using Amazon Lightsail (Including Custom Domain + SSL)

Building an Omeka S Site Using Amazon Lightsail (Including Custom Domain + SSL)

Update History 2022/09/08 Updated the script descriptions to the latest version. Overview Amazon Lightsail is described as follows: Amazon Lightsail is an easy-to-use virtual private server (VPS) that makes it easy to manage cloud resources such as containers at a predictable, low price. This article introduces how to build Omeka S using Amazon Lightsail. It also covers the “custom domain” and “SSL” configuration that are generally required when making a database publicly available. ...

Running the NDLOCR Application Using Google Cloud Platform Compute Engine

Running the NDLOCR Application Using Google Cloud Platform Compute Engine

Overview This is a memo about running the NDLOCR application published by NDL (National Diet Library) using a virtual machine on GCP (Google Cloud Platform). For details about this application, please refer to the following repository. https://github.com/ndl-lab/ndlocr_cli Creating a VM Instance Access Compute Engine on GCP and click the “Create Instance” button at the top of the screen. Under “Machine configuration” > “Machine family”, select “GPU”. Then for “GPU type”, select “NVIDIA T4”, which is the most affordable option. Set “Number of GPUs” to 1. ...

Using The New York Public Library API

Using The New York Public Library API

Overview The New York Public Library provides a Digital Collections API. http://api.repo.nypl.org/ This article explains an example of how to use this API. Sign Up First, click the following link to sign up. A form like the following will be displayed, so enter the required information. After entering your information, you will receive an email with the subject Welcome to NYPL API. This email contains the Authentication Token. ...

Experiments on Image Sizes Supported by serverless-iiif

Experiments on Image Sizes Supported by serverless-iiif

Overview In the following article, I explained how to build an IIIF Image Server using an AWS serverless application. This time, I register a relatively large image and verify whether tile image delivery is possible. Target This time, the target is “Mining Claim Maps” (held by the University of Tokyo Komaba Library). https://iiif.dl.itc.u-tokyo.ac.jp/repo/s/ichiko/document/4120a330-2f1c-4e2c-5d48-21aed4d42704 The original image is a TIF file of nearly 300 MB. Creating Pyramidal Tiled TIFF Referencing the following site, I tried both VIPS and ImageMagick. ...

Usage Example of Leaflet with Vue 3 (Including Coordinate Range Retrieval)

Usage Example of Leaflet with Vue 3 (Including Coordinate Range Retrieval)

I created a repository introducing a usage example of Leaflet with Vue 3 (including coordinate range retrieval). The working example is available here: https://static.ldas.jp/vue3-leaflet/ The source code is available here: https://github.com/ldasjp8/vue3-leaflet As a Vue 3 beginner, there may be errors, but we hope this serves as a useful reference.

Setting Focus on a Text Field Inside a Dialog When Opening It in Vuetify

Setting Focus on a Text Field Inside a Dialog When Opening It in Vuetify

The following was helpful. https://stackoverflow.com/questions/59407003/set-focus-text-field-inside-dialog-when-dialog-opened By accessing $refs after a short delay when opening the dialog, it worked successfully. watch: { dialog: function(value) { if (value) { setTimeout(() => { this.$refs.name.focus(); }, 200); } } }

How to Enable Hot Reload for the static Directory in Nuxt.js

How to Enable Hot Reload for the static Directory in Nuxt.js

The explanation was found at the following link. https://develop365.gitlab.io/nuxtjs-2.8.X-doc/ja/api/configuration-watch/ export default { ..., generate: { fallback: true, }, watch: ['static'], } By providing watch in the nuxt.config.js file as shown above, the target directory became a watch target as well.

Introduction to IIIF Presentation API Validation Methods with Practical Examples

Introduction to IIIF Presentation API Validation Methods with Practical Examples

Overview As described in a previous article, I developed an application that delivers IIIF manifest files and provides the IIIF Content Search API. https://zenn.dev/nakamura196/articles/76bdc86b1b7524 However, there were parts that did not conform to the API specifications. This article shares the corrections made and introduces how to use the Presentation API Validator with practical examples. https://presentation-validator.iiif.io/ Manifest File Corrections Access the Presentation API Validator site above, enter the manifest file URL in URL of Manifest to Validate, and select the corresponding API version (in this case, 3.0). ...

GCP: Handling Errors When Creating AI Platform Notebooks

GCP: Handling Errors When Creating AI Platform Notebooks

I created a notebook instance using the following as a reference. https://cloud.google.com/blog/ja/topics/developers-practitioners/pytorch-google-cloud-how-train-pytorch-models-ai-platform gcloud notebooks instances create example-instance \ --vm-image-project=deeplearning-platform-release \ --vm-image-family=pytorch-1-7-cu110-notebooks \ --machine-type=n1-standard-4 \ --location=us-central1-a \ --boot-disk-size=100 \ --accelerator-core-count=1 \ --accelerator-type=NVIDIA_TESLA_T4 \ --install-gpu-driver \ --network=default At that time, I was unable to create the notebook instance due to the following error. ERROR: (gcloud.notebooks.instances.create) The zone 'projects/{project}/zones/us-central1-a' does not have enough resources available to fulfill the request. '(resource type:compute)'. Therefore, I changed the location from us-central1-a to us-central1-b, and was able to create the instance. ...

How to Delete a Feature Store in GCP Vertex AI

How to Delete a Feature Store in GCP Vertex AI

Overview This is a note on how to delete a feature store in Vertex AI on GCP (Google Cloud Platform). I later noticed that official documentation was available at the following link. https://cloud.google.com/vertex-ai/docs/featurestore/managing-featurestores#delete_a_featurestore Method In this example, I will attempt to delete a feature store called test as shown below. It could be deleted by executing the following command. (I was unable to find a way to delete it from the GUI.) ...

【使い方編】国立国会図書館「次世代デジタルライブラリー」で公開されているOCR結果をIIIFビューアで閲覧するアプリを作成しました。

概要 使い方 Miradorでの表示例 Curation Viewerでの表示例 まとめ 概要 国立国会図書館「次世代デジタルライブラリー」で公開されているOCR結果をIIIFビューアで閲覧するアプリを作成しました。 以下のURLからお試しいただけます。 https://static.ldas.jp/ndl-ocr-iiif/ 使い方 入力フォームに、「次世代デジタルライブラリー」で公開されている資料のIDを入力します。 しばらくすると、「Mirador」とCODHが公開する「Curation Viewer」のボタンが表示されます。それぞれのビューアで、OCR結果をご確認いただけます。 Miradorでの表示例 特に、「Mirador」については、「IIIF Content Search API」にも対応し、資料内検索が可能です。 https://iiif.io/api/search/1.0/ Curation Viewerでの表示例 まとめ 本記事では本アプリの使い方について説明しました。以下の記事では、本アプリの構築方法について説明しています。こちらも参考になりましたら幸いです。 nakamura196.hatenablog.com

【AWS関連】AWS Lambda + Docker + pyvipsを用いたPyramid Tiled Tiffファイルの作成

概要 Amazon ECRリポジトリの作成 Lambda関数の作成 S3 バケットの作成 イベント通知設定 Lambda関数の設定 環境変数の設定 アクセス権限 基本設定 試す まとめ 概要 AWS LambdaとDockerとpyvipsを用いて、S3に格納された画像から、Pyramid Tiled Tiffファイルを作成するイメージを作成しました。 Amazon ECR Public Galleryは以下です。 https://gallery.ecr.aws/nakamura196/lambda-docker-vips-python ソースコードは以下です。 https://github.com/ldasjp8/lambda-docker-vips-python 以下、使用方法について説明します。 Amazon ECRリポジトリの作成 まず、ECRリポジトリを作成します。 次に、「プッシュコマンドの表示」から、コマンドを確認して、イメージをpushします。 以下、コマンドの例です。 git clone https://github.com/ldasjp8/lambda-docker-vips-python.git cd lambda-docker-vips-python aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin XXXX.dkr.ecr.us-east-1.amazonaws.com docker build -t lambda-docker-vips-python . docker tag lambda-docker-vips-python:latest XXXX.dkr.ecr.us-east-1.amazonaws.com/lambda-docker-vips-python:latest docker push XXXX.dkr.ecr.us-east-1.amazonaws.com/lambda-docker-vips-python:latest 結果、以下のようにイメージがECRリポジトリに表示されます。 そして、以下の「イメージのURI」をコピーしておきます。 Lambda関数の作成 次にLambda関数を作成します。今回は、my-lambda-docker-vips-pythonという関数名にしました。「コンテナイメージURI」に、先ほどコピーしたURIを入力します。 そして、「関数を作成」ボタンを押して、関数を作成します。 S3 バケットの作成 今回、画像を登録するためのバケットと、上記の関数により変換した画像を格納するバケットの2つを用意します。 今回は、my-lambda-docker-vips-python-inputとmy-lambda-docker-vips-python-outputの2つを作成しました。 ...

How to Use pyvips and Create Pyramid Tiled TIFF Files

How to Use pyvips and Create Pyramid Tiled TIFF Files

Overview I created a program to generate Pyramid Tiled TIFF files using pyvips. You can try it on the following Google Colab. https://colab.research.google.com/drive/1VO1PgKgS3H21zXpg4g2inN-mtIrON5TQ?usp=sharing When delivering images via IIIF, there are situations where Pyramid Tiled TIFF files need to be created. We hope this is helpful for image conversion using Python and Vips. The parameters are based on the following. https://github.com/samvera-labs/serverless-iiif#using-vips Also, as one example of how to deliver converted Pyramid Tiled TIFF files, the following article may also be helpful. ...

[Memo] How to Use Maplat

[Memo] How to Use Maplat

This is a memo on how to use Maplat, a historical map viewer library. https://github.com/code4history/Maplat In addition to the above GitHub repository, the following Qiita articles are also helpful. https://qiita.com/tags/maplat?page=1 Downloading MaplatEditor Download the latest version of MaplatEditor from the following page. https://github.com/code4history/MaplatEditor/wiki Creating Data Launch the installed MaplatEditor and click the “New” button. Enter the required metadata. The items shown in the figure below are mandatory fields. ...

I Created a Calendar Search App

I Created a Calendar Search App

Overview I created a web application that displays information in a calendar format. Below is a display example targeting a list of Hatena Blog articles. https://static.ldas.jp/calendar/?u=https://nakamura196.github.io/json/calendar.json https://github.com/ldasjp8/calendar You can check the display example by accessing the following URL and clicking the “Example” button, then the “Add” button. https://static.ldas.jp/calendar/ You specify the URL of a JSON file in the following format as a parameter. https://nakamura196.github.io/json/calendar.json Below, I will explain how to create the JSON file from an Excel file as one example method. ...

【AWS関連】AWS Lambdaを用いた物体検出API(Flask + yolov5)の構築

概要 AWS Lambdaを用いた物体検出API(Flask + yolov5)の構築を行います。機械学習の推論モデルをAWS Lambdaを用いて構築することにより、コストの軽減を目指します。 以下の記事を参考にさせていただいています。 https://zenn.dev/gokauz/articles/72e543796a6423 リポジトリの内容の更新や、API Gatewayからの利用方法の追記などを行なっています。 Lambdaへの関数登録 以下のGitHubリポジトリをクローンします。 git clone https://github.com/ldasjp8/yolov5-lambda.git ローカルで実行する 次に、venvを用いて仮想環境を作成して、モジュールをインストールします。 cd yolov5-lambda python -m venv venv source venv/bin/activate cd yolov5 pip install --upgrade pip pip install -r requirements.txt その後、以下を実行すると、物体検出結果のjsonデータが出力されます。 python app.py デプロイ 冒頭で述べた通り、以下の記事の成果を利用させていただいています。 https://zenn.dev/gokauz/articles/72e543796a6423 ここでは、Jupyter Notebookを利用します。 cd ../ jupyter notebook Jupyter Notebookが起動した後、以下のbuild_and_test.ipynbを選択して、手順の通りに実行します。 今回作成したリポジトリで変更した点として、まずconf.jsonファイルをロードするようにしています。 cloneしたリポジトリにconf.json.templateを格納していますので、conf.jsonに名前を変えて、profile項目に、AWS CLIにプロファイル名を与えてください。 mv conf.json.template conf.json code conf.json Notebookの実行にあたっては、dockerを起動しておく必要があります。 (オプション)AWS Lambdaでのテスト実行 以下、AWS Lambdaでのテストの実行方法を示します。なお、上記のNotebook内で推論まで実行するため、本作業は必須ではありません。(私の備忘録です。) Lambdaの関数ページにアクセスし、「テスト」タブを選択します。 そして、以下に示すように、テンプレートで「agigateway-aws-proxy」を選択し、サンプルとして利用する画像のbase64エンコードされた文字列を、body項目に与えます。画像のbase64エンコードされた文字列の作成については、上記のNotebookの「推論してみる」の項目にありますので、参考にしてください。 以下のように実行結果を確認することができます。 API Gatewayの設定 API Gatewayの「APIを作成」から、REST APIの「構築」をクリックし、 ...

Building an Object Detection API Using AWS Lambda (Flask + YOLOv5)

Building an Object Detection API Using AWS Lambda (Flask + YOLOv5)

Overview We build an object detection API (Flask + YOLOv5) using AWS Lambda. By building a machine learning inference model using AWS Lambda, we aim to reduce costs. The following article was used as a reference. https://zenn.dev/gokauz/articles/72e543796a6423 Updates to the repository contents and additions of how to use it from API Gateway have been made. Registering Functions on Lambda Clone the following GitHub repository. git clone https://github.com/ldasjp8/yolov5-lambda.git Running Locally Next, create a virtual environment using venv and install the modules. ...

[Omeka S Module] How to Use Clean Url

[Omeka S Module] How to Use Clean Url

Overview This article explains how to assign identifiers to resources (item sets, items, media) in Omeka S. Specifically, it explains how to use the “Clean Url” module. https://github.com/Daniel-KM/Omeka-S-module-CleanUrl Installation The following assumes that Omeka S is installed in a folder named omeka-s-sandbox. /home/xxxx/www/omeka-s-sandbox/ The README recommends installing the related module “Generic.” https://github.com/Daniel-KM/Omeka-S-module-CleanUrl#installation Execute the following. wget https://github.com/Daniel-KM/Omeka-S-module-Generic/releases/download/3.3.34/Generic-3.3.34.zip unzip Generic-3.3.34.zip The above is an example of downloading Generic v3.3.34. For the latest version, access the following and obtain the URL from the location shown in the screenshots. ...