0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

tarコマンドのエラー(未解決)

Posted at

はじめに

前回のチュートリアルに引き続き、SageMakerを触ってみたいという思いから資料を探してみたところ、機械学習を利用した画像判定Webアプリケーションの作成を行うハンズオン資料を発見した為、実施してみる事にしました。
しかし、SageMakerの実行途中でエラーが発生し、解消する事が出来なかった為断念しました。本記事では発生したエラー事象について記載します。

以下、構築予定だったアーキテクチャの概要です。

ai-ml01-02.png

(http://www.intellilink.co.jp/article/column/ai-ml01.html より引用)

また、以下が開発するWebアプリケーションの完成形イメージになります。
画面左側で判定したい画像を選択し、画像に何が写っているかの判定結果を画面右側に表示する仕組みです。

ai-ml01-01.png

(http://www.intellilink.co.jp/article/column/ai-ml01.html より引用)

本編

ハンズオン資料を参照し、

  • S3作成
  • SageMakerによる機械学習部分の実施

と進めていったが、SageMakerを実行した所、エラーが発生している事を確認。

ログを確認すると、以下の実行部分でエラーが表示されている。

%%bash

mkdir -p caltech_256_train_60
for i in 256_ObjectCategories/*; do
    c=`basename $i`
    mkdir -p caltech_256_train_60/$c
    for j in `ls $i/*.jpg | shuf | head -n 60`; do
        mv $j caltech_256_train_60/$c/
    done
done

python im2rec.py --list --recursive caltech-256-60-train caltech_256_train_60/
python im2rec.py --list --recursive caltech-256-60-val 256_ObjectCategories/

エラー文言は以下。

ls: cannot access 256_ObjectCategories/*/*.jpg: No such file or directory

更に確認を続けていると、1つ前の実行部分が、中断はされていないものの以下のメッセージを出力していた。以下は実行部分。

import os
import urllib.request

def download(url):
    filename = url.split("/")[-1]
    if not os.path.exists(filename):
        urllib.request.urlretrieve(url, filename)


# Caltech-256 image files
download('http://www.vision.caltech.edu/Image_Datasets/Caltech256/256_ObjectCategories.tar')
!tar -xf 256_ObjectCategories.tar

# Tool for creating lst file
download('https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/im2rec.py')

メッセージは以下。

tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors

tarの解凍コマンドを実行しているが、対象ファイルがtar形式ではないので処理をスキップしている、とのこと。

  • tarファイルではない?
    →対象を確認したが、tarファイルだった
  • 権限等の原因でダウンロード出来ていない?
    →tarコマンドなしで実行したが、問題なくダウンロードできた
  • tarコマンドのオプションが間違っている?
    今回のtarコマンドのオプションは以下。
    x:アーカイブされたファイルを解凍し展開・復元を行う
    f:アーカイブファイル名を指定する
    →コマンドfを外して実行してみた所、上記メッセージは出力されなくなったものの終わらず。

調べてみると、tar.gzになっていると上手く解凍できない事があるようだが今回gzip圧縮もされておらず。。。
断念し一旦中断。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?