#!/bin/bash -x SERVER='127.0.0.1' PORT='9200' INDEX='index' TYPE='type' curl -XPOST "http://$SERVER:9200/$INDEX/$TYPE/_delete_by_query?conflicts=proceed&pretty" -d '{ "query": { "match_all": { } } }'
Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so.
参考ページ
stackoverflow.com
scikit-learn で LogisticRegression 実行中にエラーで
Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so.
mkl使わないようにする
conda install nomkl numpy scipy scikit-learn numexpr conda remove mkl mkl-service
OK
RemoveError: 'pyopenssl' is a dependency of conda and cannot be removed from conda's operating environment.が出た時にやったこと メモ
アップデートしたら
conda update --all
エラーが出た
RemoveError: 'pyopenssl' is a dependency of conda and cannot be removed from conda's operating environment.
本体のアップデートやってから
conda update --force conda
もう一回
conda update --all
OK
Elasticsearch 既存のスキーマにフィールドを追加する
参考ページ
www.elastic.co
#!/bin/bash -x SERVER='hoge.hoge.com' PORT='9200' INDEX='index' TYPE='type' curl -X PUT http://$SERVER:$PORT/$INDEX/$TYPE/_mapping?pretty -d ' { "properties" : { "new_field1" : { "type" : "keyword" }, "new_field2" : { "type" : "keyword" } } }'
Selenium で撮った スクリーンショット を ImageNet の学習済みモデルを使って 何のページか雑に推定してみる
推定してみるページ その1
www.min-inuzukan.com
推定してみるページ その2
www.instagram.com
結果 : 動物だけだと簡単すぎたかも...
みんなの犬図鑑 - トイプードル 0.png ← その1のページ ('n02113624', 'toy_poodle', 0.9494451) ('n02113712', 'miniature_poodle', 0.0339178) ('n02113799', 'standard_poodle', 0.015091205) ('n02093647', 'Bedlington_terrier', 0.0007793304) ('n06359193', 'web_site', 0.00039212801) Instagram photo by Grumpy Cat • Aug 7, 2018 at 5:27 AM 1.png ← その2のページ ('n02123597', 'Siamese_cat', 0.75590235) ('n06359193', 'web_site', 0.23546399) ('n03782006', 'monitor', 0.0041238526) ('n04152593', 'screen', 0.0006635995) ('n02123394', 'Persian_cat', 0.00024246887)
ソース
import numpy as np import sys # keras 関係 from keras.applications.vgg16 import VGG16, preprocess_input, decode_predictions from keras.applications.vgg19 import VGG19, preprocess_input, decode_predictions from keras.applications.resnet50 import ResNet50 from keras.applications.inception_v3 import InceptionV3, preprocess_input from keras.preprocessing import image model = InceptionV3(weights='imagenet') # Selenium 関係 from selenium import webdriver options = webdriver.ChromeOptions() options.add_argument('--headless') driver = webdriver.Chrome(options=options) # 推定してみるページ urls = ['https://www.min-inuzukan.com/toy-poodle.html', 'https://www.instagram.com/p/BmJpw3XBTiY/?utm_source=ig_embed'] for i in range(len(urls)) : url = urls[i] file_name = str(i)+'.png' driver.get( url ) #スクリーンショット取得 driver.save_screenshot( file_name ) # イメージ分類 img = image.load_img(file_name, target_size=(224, 224)) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) preds = model.predict(preprocess_input(x)) results = decode_predictions(preds, top=5)[0] # 結果出力 print(driver.title, file_name ) for result in results: print(result) driver.quit()
Windows10 に Selenium 環境を作る
下記を参考に構築
qiita.com
conda install selenium
Chrome のバージョンが 72 だったので下記から ChromeDriver 2.46 をダウンロードして解凍
chromedriver.chromium.org
できたchromedriver_win32 フォルダ を以下にコピーしてパスを通した
C:\Program Files (x86)
以上
AWS EC2 に Selenium 環境作った メモ
下記を参考に構築
qiita.com
> sudo su - # curl https://intoli.com/install-google-chrome.sh | bash Successfully installed google-chrome-stable, Google Chrome 72.0.3626.109 . 途中 エラーが出ても気にしない... # vim /etc/yum.repos.d/centos.repo [CentOS-base] name=CentOS-6 - Base mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #released updates [CentOS-updates] name=CentOS-6 - Updates mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [CentOS-extras] name=CentOS-6 - Extras mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 # rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 # yum -y install GConf2 以下から Google Chrome のバージョンにあう ChromeDriver のバージョンをダウンロード https://sites.google.com/a/chromium.org/chromedriver/downloads # wget https://chromedriver.storage.googleapis.com/2.46/chromedriver_linux64.zip # unzip chromedriver_linux64.zip # mv chromedriver /usr/local/bin # wget https://noto-website-2.storage.googleapis.com/pkgs/Noto-hinted.zip # unzip Noto-hinted.zip # mkdir -p /usr/share/fonts/opentype/noto # cp *otf *ttf /usr/share/fonts/opentype/noto # fc-cache -f -v # optional >conda install selenium