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()