项目作者: gavinconran

项目描述 :
An Art Image Classifier fine-tuned from pre-trained Convolutional Neural Networks
高级语言: Java
项目地址: git://github.com/gavinconran/ArtNet.git
创建时间: 2018-05-06T15:44:31Z
项目社区:https://github.com/gavinconran/ArtNet

开源协议:

下载


ArtNet

Introduction

Out of a general interest in the Arts & Humanities I found myself studying Ancient Greek and Latin, Greek and Roman Mythology, Ancient Greek History, Ancient Philosophy, Arab-Islamic History, Japanese and Classical Music in addition to following the BBC’s multitude of excellent arts and history programs. To further my knowledge of Artificial Intelligence I took courses, such as Digital Signal Processing, Image & Video Processing, Advanced Software Construction in Java, Advanced C++, Machine Learning, Robotics, Cloud Computing, Analytics in Python and Data Modelling.

ArtNet successfully combines my interests in the arts & sciences, in particular Art & Artificial Intelligence, and brings together my study and work of the last couple of years into a single piece of research, marking a personal learning milestone.

Create the ArtNet Model using TensorFlow

This repository contains the paper “ArtNet:An Art Image Classifier fine-tuned from pre-trained Convolutional Neural Networks“ together with supporting documentation and code.

To replicate the best performing model, as described in the paper, you must first install TensorFlow, preferably in a virtual environment [https://www.tensorflow.org/install/install_linux].

Once TensorFlow is installed and the virtual environment activated, run the shell script:

  1. (tensorflow) $ ./retrainHub_InceptionV4.sh

at the command line, which in turn calls the python program, retrain.py.

The above script trains, validates and tests an ArtNet model and the test images discussed in the paper can be replicated by executing the following Jupyter Notebook, ArtNet_Classification.ipynb, found in the ArtNet_Clients directory, along with the test data folder, dataTestPaper.

N.B.: The results will be different from the paper due to the use of the ‘Hub’ version of retrain.py. I used the pre-Hub version of retrain.py when writing the paper. That said, the generated ArtNet model is valid and should have an accuracy very close to that described in the paper.

Training and validation progress can be visualised by using tensorboard by executing the following command

  1. (tensorflow) $ tensorboard --logdir=./models

Deploy a Model Server using TensorFlow

To setup a Model Server I refer the reader to the online tutorial [https://www.tensorflow.org/serving/setup]. It is possible to intall the prerequisites using two options:

  1. by pip (install pre-compiled binaries)
  2. by bazel (compile from source)

The following instructions will use pip.

To start the server execute the following command at the command line:

  1. (tensorflow) $ tensorflow_model_server --port=9000 --model_name=artnet --model_base_path=/path/to/model/

N.B.: /path/to/model/ is the absolute path to the model directory (which in my case is the models directory, as above)

I have provided a script, ArtNet_Client.py, for users to test the ArtNet server. It can be found in the directory ArtNet_Clients. To operate:

  1. (tensorflow) $ python ArtNet_Client.py --server=localhost:9000 \
  2. --image=./dataPaperTest/1454_VirginAndChild_Rogier_van_der_Weyden.jpeg

Deploy the ArtNet Server using TensorFlow in a Docker Container

To setup an ArtNet Docker Image please refer to ArtNet_Docker/README.md.

Once you have created the docker image, $USER/artnet_serving, you can run the associated container with the following command:

  1. $ docker run -p 9000:9000 -it $USER/artnet_serving
  2. root@854459658fb4:/# tensorflow_model_server --port=9000 --model_name=artnet --model_base_path=/ArtNet/models &> artnet_log &

In a new terminal, query the ArtNet server

  1. cd ArtNet_Clients
  2. $ python ArtNet_Client.py --server=localhost:9000 \
  3. --image=./dataPaperTest/1454_VirginAndChild_Rogier_van_der_Weyden.jpeg

The image, $USER/artnet_serving, can be deployed to a serving cluster with Kubernetes in the Google Cloud Platform as described in [https://www.tensorflow.org/serving/serving_inception].

Extend TensorFlow by creating a new Op

As a pedagogical exercise I added a new Op, called CopyOfInputOp, by following the instructions in [https://www.tensorflow.org/extend/adding_an_op]. The new op is a very simple operation that just returns the input. The files can be found in the directory TensorFlow_Extend. The source code must be compiled on your own machine and can be done by executing the following script in the TensorFlow_Extend directory:

  1. (tensorflow) $ ./compileCopyOfInputOp.sh

To create an ArtNet model using this new Op, run the shell script:

  1. (tensorflow) $ ./retrainHub_InceptionV4_Extend.sh

at the command line, which in turn calls the python program, retrain_Extend.py.

Training and validation progress can be visualised by using tensorboard by executing the following command

  1. (tensorflow) $ tensorboard --logdir=./models/CopyOfInputOp

Note:

When running ArtNet_Classification.ipynb with the ArtNet model created with the new op, the following lines of code must be included in the notebook:

  1. model_file = "../models/CopyOfInputOp/output_graph.pb"
  2. label_file = "../models/CopyOfInputOp/output_labels.txt"
  3. tf.load_op_library('../TensorFlow_Extend/copy_of_input.so')
ArtNet_1648789773957.pdf
CNN_PaperSummaries_1648789774453.pdf
FourierPaper_1648789775537.pdf
GaussPaper_1648789776272.pdf
NewtonPaper_1648789776578.pdf
EulerPaper_1648789776928.pdf
DescartesPaper_1648789777228.pdf
handout_1648789777755.pdf
Lovelace_1648789778305.pdf
CopernicusPaper_1648789778459.pdf
FlipTab_Presentation_1648789778819.pdf
Gavin_Conran_Technology_Entrepreneurship_1648789778933.pdf
Business_Plan_1648789779227.pdf
Competitor Analysis_1648789779352.pdf
Introduction to SPM - Course Notes (1)_1648789779667.pdf
Software-Process-and-Agile-Practices---Glossary_1648789779804.pdf
Software-Processes-and-Agile-Practices---Course-Notes_1648789779924.pdf
Client-Needs-and-Software-Requirements---Course-Notes_1648789780314.pdf
Client-Needs-and-Software-Requirements-Glossary_1648789781014.pdf
alliance-party-membership-application-form_1648789781279.pdf
MyAlliance Evaluation Plan_1648789781399.pdf
MyAlliance Plan - MyAlliance_Plan_1648789781469.pdf
Response to Testing Tester Tester#1_1648789781535.pdf
User_Test_Written_Instructions_and_Questions_1648789781807.pdf
myAlliance-consent-form_1648789781900.pdf
ML4WebDesign_1648789782030.pdf
Statement of Accomplishment (4)_1648789782195.pdf
bricolageICML12_1648789782280.pdf
Higgins-1990_1648789782430.pdf
Hoyle-1973_1648789782653.pdf
Sample 30584_1648789782791.pdf
Wobbrock-2011_1648789782958.pdf
ps4hci.key_1648789783426.pdf
ps4hci_1648789783711.pdf
Resource-GoodQuestionstoAskYourClient_1648789783975.pdf
Gavin_Conran_Technology_Entrepreneurship_1648789784613.pdf
market_size_1648789786021.pdf
millennialmedia-mobilemix-november-2012_1648789786239.pdf
MyAlliance Evaluation Plan_1648789786596.pdf
MyAlliance Plan - MyAlliance_Plan_1648789786647.pdf
User_Test_Written_Instructions_and_Questions_1648789787047.pdf
Assignment_1648789788404.pdf
Assignment2_1648789788432.pdf
userStories_1648789788535.pdf
slide_plus_1648789788673.pdf
Agile-Planning-for-Software-Products---Glossary_1648789789012.pdf
Agile-Planning-for-Software-Products.7.1_1648789789133.pdf
PERTChart_1648789789294.pdf
REX-Transition-Agile-Google_1648789789391.pdf
ReleasePlan_1648789789513.pdf
WBS_Assignment_1648789789592.pdf
Worksheet-EstimatingTaskTimes_1648789789696.pdf
82.78_1648789789807.pdf
Course-Notes---Reviews-_-Metrics-for-Software-Improvements_1648789789851.pdf
Reviews-_-Metrics-Glossary_1.0_1648789790049.pdf
alliance-party-membership-application-form_1648789790212.pdf
MyAlliance Evaluation Plan_1648789790243.pdf
MyAlliance Plan - MyAlliance_Plan_1648789790265.pdf
Response to Testing Tester Tester#1_1648789790294.pdf
User_Test_Written_Instructions_and_Questions_1648789790372.pdf
myAlliance-consent-form_1648789790408.pdf
ML4WebDesign_1648789790474.pdf
Statement of Accomplishment (4)_1648789790583.pdf
bricolageICML12_1648789790662.pdf
Higgins-1990_1648789790798.pdf
Hoyle-1973_1648789790928.pdf
Sample 30584_1648789790998.pdf
Wobbrock-2011_1648789791103.pdf
ps4hci.key_1648789791289.pdf
ps4hci_1648789791449.pdf
Requirements_Document_1648789791918.pdf
ArtNet_1648789792207.pdf
JobsPaper_1648789792263.pdf
FlipTab_1648789787349.pptx
SalesAndMarketing_1648789787901.pptx
Online_Marketing_Options_for_FlipTab (Draft)_1648789785152.docx
Tech_Sources_1648789785299.docx
FlipTab Evaluation Plan 11Nov2012_1648789785427.docx
FlipTab Evaluation Plan_1648789785496.docx
MyAlliance Evaluation Plan_1648789786479.docx
User_Test_Written_Instructions_and_Questions 11Nov2012_1648789786920.docx
User_Test_Written_Instructions_and_Questions_1648789787031.docx
Report_1648789787141.docx
Report_2_1648789787207.docx
Opportunity Execution Project_1648789787707.docx
Opportunity_Execution_Project_11Dec2012_1648789787788.docx
personal_business_plan_1648789787810.docx
feedbackAss4_1648789788285.docx
Response to Testing Tester#1_1648789790328.docx
User_Test_1648789790343.docx
ps4hci_1648789791179.docx
ps4hci.key_1648789791206.docx
~$4hci.key_1648789791806.docx
~$ps4hci_1648789791889.docx
About_FlipTab_1648789784062.pptx
Assignment4_1648789784220.pptx
FlipTab_1648789784380.pptx
GPS shoes_1648789784528.pptx
Opportunity_Execution_Project_11Dec2012_1648789779101.docx
Response to Testing Tester#1_1648789781679.docx