This commit is contained in:
shoney.arickathil 2023-09-20 01:09:18 +02:00
parent c1d07398c8
commit 57e43bef7e
10 changed files with 175 additions and 11 deletions

View file

@ -138,7 +138,8 @@
@online{wikiapi, @online{wikiapi,
year = {2023}, year = {2023},
title = {Wikipedia API documentation}, title = {Wikipedia API documentation},
url = {https://wikipedia-api.readthedocs.io/en/latest/wikipediaapi/api.html} url = {https://wikipedia-api.readthedocs.io/en/latest/wikipediaapi/api.html},
urldate = {2023-06-02}
} }
@ -149,7 +150,7 @@
title = {{Wikipedia special exports}}, title = {{Wikipedia special exports}},
howpublished = {\url{https://en.wikipedia.org/wiki/Special:Export}}, howpublished = {\url{https://en.wikipedia.org/wiki/Special:Export}},
year = {2023}, year = {2023},
note = {[Online; accessed 01-May-2023]} urldate = {2023-05-01}
} }
@ -510,3 +511,29 @@ urldate = {2023-08-05},
} }
@online{RM,
author = {Retromotion.com},
title = {Spare parts shop},
url = {https://retromotion.com/p/vaico-v70-0613},
urldate = {2023-08-05},
year = {2023}
}
@online{iceclog,
author = {Martijn Hoogeveen},
title = {What is Product Information Management (PIM) in a Multimedia World?},
url = {https://iceclog.com/what-is-product-information-management-in-a-multimedia-world/},
urldate = {2023-08-09},
year = {2019}
}
@online{savept,
author = {Matthew Inkawhich},
title = {SAVING AND LOADING MODELS},
url = {https://pytorch.org/tutorials/beginner/saving_loading_models.html},
urldate = {2023-08-09},
year = {2023}
}

View file

@ -18,7 +18,65 @@ For this project, python client elasticsearch 6.8.2 is installed as the client n
\end{lstlisting} \end{lstlisting}
% Content for Appendix A goes here... % Content for Appendix A goes here...
\subsection*{Confusion matrix}
\begin{lstlisting}[language=Python,caption={Confusion matrix},label={code:confusion matrix}]
def confusionMatix(self,df_en):
# Keep track of correct guesses in a confusion matrix
data = Data(df_en)
n_categories = len(data.all_category)
batch = random.choices(data.all_category,k=20)
confusion = torch.zeros(n_categories, n_categories)
n_confusion = 10000
# Go through a bunch of examples and record which are correctly guessed
for i in range(n_confusion):
category, name, category_tensor, name_tensor = data.randomTrainingExample()
if category in batch:
output = self.evaluate(name_tensor)
guess, guess_i = data.categoryFromOutput(output)
category_i =data.all_category.index(category)
confusion[category_i][guess_i] += 1
# Normalize by dividing every row by its sum
for i in range(20):
confusion[i] = confusion[i] / confusion[i].sum()
# Set up plot
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.matshow(confusion.numpy())
fig.colorbar(cax)
# Set up axes
ax.set_xticklabels([''] + data.all_category, rotation=45)
ax.set_yticklabels([''] + data.all_category)
# Force label at every tick
ax.xaxis.set_major_locator(ticker.MultipleLocator(1))
ax.yaxis.set_major_locator(ticker.MultipleLocator(1))
# sphinx_gallery_thumbnail_number = 2
plt.show()
plt.savefig('confusion.png', dpi=400)
\end{lstlisting}
\subsection*{Load PyTorch model}
\begin{lstlisting}[language=Python,caption={Load PyTorch model},label={code:Loadpt}]
class Predict():
def __init__(self):
self.rnn = torch.load('ngram-rnn-classification.pt')
\end{lstlisting}
\section{Appendix B} \section{Appendix B}
% Content for Appendix B goes here... \begin{figure}
\centering
\includegraphics[scale=0.5]{ht_rm.jpg}
\caption{Hydraulic filter automatic transmission VAICO V70-0613 for Lexus RX \parencite{RM}}
\label{fig:sparepart}
\end{figure}
\end{appendices} \end{appendices}

View file

@ -54,10 +54,18 @@
There is a scope of research on image classification and its use cases in the E-commerce industry. Images are vital component of an E-commerce website. There is saying ``A picture is worth a thousand words''. The product image itself has so much information to be tapped. There is a scope of research on image classification and its use cases in the E-commerce industry. Images are vital component of an E-commerce website. There is saying ``A picture is worth a thousand words''. The product image itself has so much information to be tapped.
Few of them are listed below:
\begin{itemize} \begin{itemize}
\item Image captioning. \item Image captioning.
Generating text based on image, describing its features such as color. Generating text from the image is a useful process in E-commerce. For example, product image also describes its features such as color. Such information can be added to the caption of the image. \parencite[Section 15.4.7]{pml1Book} describes an example of image captioning using the sequential data processing network with \textbf{attention algorithm}.
\item Attention based image classification.
\parencite{Vaswani.12062017} proposes a network architecture named Transformers which uses attention in the encoder and decoder in the machine translation tasks. Using the transformer model to process the sequence of pixels in a product image to identify the clustered components or to identify which other product could be a part of the product.
For example, image from Appendix B figure \ref{fig:sparepart} is product image, using attention based image classification, identifying the products which fit in and around the processed product image could enable E-Commerce industries cluster the products.
\item Image based categorization. \item Image based categorization.
@ -68,6 +76,4 @@
Using \acfp{GAN} \parencite{Goodfellow.31122016}, a sketch can be converted to photorealistic image. Using \acfp{GAN} \parencite{Goodfellow.31122016}, a sketch can be converted to photorealistic image.
\end{itemize} \end{itemize}

View file

@ -70,6 +70,55 @@ In figure \ref{fig:sample-product-taxonomy}, is a sample of product taxonomy rep
\end{enumerate} \end{enumerate}
\section{\acf{PIM}}
\acl{PIM} system is an information system that facilitates the manufactures and distribution channel such as an e-commerce website with a central hub of product data \parencite{iceclog}. \acs{PIM} system manages products details such name, description, manufacturer, price as well as the products' taxonomy. A PIM system may also include the \acf{SKU}. \acsp{SKU} enables the distribution channels to determine which product require reordering and also provides sales data. Distribution channels may also have an extended version of the \acs{SKU} than the one provided by the suppliers.
\acsp{PIM} are the point of source to verify whether the products' taxonomy are correct and also if the stock is available before distribution channels make it publically available for sales.
% \begin{tikzpicture}[
% node distance=1cm,
% every node/.style={font=\footnotesize},
% arrow/.style={->,>=Stealth},
% process/.style={rectangle, draw, text centered, minimum width=2.5cm, text width=2.5cm},
% decision/.style={diamond, draw, text centered, aspect=2},
% arrowlabel/.style={midway, above, font=\scriptsize},
% ]
% % Define nodes
% \node (dc) [process] {Distribution Channels};
% \node (dp) [process, below=3cm of dc] {Available for Sale};
% \node (ms) [process, right=6cm of dc] {Source};
% \node (pim) [process, right=3cm of dc, yshift=-1.5cm] {PIM System};
% \node (check) [decision, below=of dc] {Verify};
% % Define arrows and labels
% \draw [arrow] (dc) -- (check);
% \draw [arrow] (check) -- node[arrowlabel] {Yes} (dp);
% \draw [arrow] (check.east) -- node[anchor=south] {No} ++(1.5,0) |- ($(pim.west) + (0,0.5)$) -- (pim.west);
% \draw [arrow] (ms) -- (pim.east) ;
% \draw [arrow] (pim.north) -- (dc.east);
% \end{tikzpicture}
% \begin{itemize}
% \item Getting updated lists of products from suppliers.
% \begin{itemize}
% \item What is the current method to get the updates?
% \item In which cycle do these updates occur? Is it the same cycle for every supplier or is it individual?
% \end{itemize}
% \item Best way to activate / deactive products.
% \begin{itemize}
% \item Would it make sense to have article level toggles in the interface that will (de)activate a product from the Reorder?
% \item Would a standardised document import be a better solution?
% \end{itemize}
% \end{itemize}
\section{Product Taxonomy Prediction Approaches} \section{Product Taxonomy Prediction Approaches}

View file

@ -283,7 +283,7 @@ Substituting \(a = \exp(x_i)\) and \(b = \sum_{j=1}^n \exp(x_j)\) in equation \e
\section{ \acs*{RNN} - Forward and Backward Propagation} \label{sec:math-rnn} \section{ \acs*{RNN} - Forward and Backward Propagation} \label{sec:math-rnn}
When a feedforward neural network are extended to include feedback connections, they are called \acfp{RNN} \parencite[Chapter 6, Page 164]{Goodfellow-et-al-2016}. \acfp{RNN} is best suited for machine learning problems that involve sequential data and use patterns to predict the output. A recurrent neural network is specialized for processing sequence of values $ x^{(1)},\ldots,x^{(t)}$. When a feedforward neural network are extended to include feedback connections, they are called \acfp{RNN} \parencite[Chapter 6, Page 164]{Goodfellow-et-al-2016}. \acfp{RNN} is best suited for machine learning problems that involve sequential data such as sequence translation, generation and classification. A recurrent neural network is specialized for processing sequence of values $ x^{(1)},\ldots,x^{(t)}$. The prediction of output $y^t$ also depends on the hidden state of the system $h^t$, which gets updated overtime as the sequence is processed \parencite[Chapter 15, Page 501]{pml1Book}.
\begin{figure}[H] \begin{figure}[H]
\centering \centering

View file

@ -484,6 +484,24 @@ In this experiment, the model is trained with and without triangular learning ra
\end{enumerate} \end{enumerate}
\section{Model Evaluation}
The model is evaluated using the confusion matrix. Confusion matrix is square matrix of predicted label $y_{pred}$ verses the true target label $y_{true}$.
Figure \ref{fig:meval} is the confusion matrix of the model trained only for 20 categories. The actual model is trained to predict around 300 categories. Author choose to attach the miniature version of the confusion matrix. Refer Appendix A code \ref{code:confusion matrix} for the python code to generate a confusion matrix.
\begin{figure}[H]
\centering
\includegraphics[scale=0.5]{confusion._200epoch.png}
\caption{Confusion matrix: with little training.
}
\label{fig:meval}
\end{figure}
\section{Model Deployment}
A \textbf{.pt} file represents the PyTorch model checkpoint file. These files store the parameter and architecture of trained PyTorch model. The PyTorch's torch.save and torch.load function uses the pythons Pickle (refer section \ref{sec:ngram_vector}) utility for serialization \parencite{savept}.
As the \acl{PIM} systems get updated with the latest details of product information, the model requires retraining for accurate prediction. Refer Appendix A code \ref{code:Loadpt} for Python code to load the trained PyTorch model.
\section{Summary} \section{Summary}

BIN
doc/images/ht_rm.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -0,0 +1,4 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://retromotion.com/p/vaico-v70-0613
HostUrl=https://retromotion.com/img/productDetail/resize/custom/83f38f06a1681a3907bf32742412706875708ab8653b354afbc917fecbb64e15.jpg

View file

@ -10,7 +10,7 @@
\usepackage{float} \usepackage{float}
\usepackage{fancyhdr} \usepackage{fancyhdr}
\usepackage[nohyperlinks, printonlyused, withpage, smaller]{acronym} \usepackage[nohyperlinks, printonlyused, withpage, smaller]{acronym}
\usepackage[backend=biber, sorting=nyt, style=ext-authoryear-icomp,dashed=false,block=par]{biblatex} \usepackage[backend=biber, sorting=nyt, style=ext-authoryear-comp,dashed=false,block=par]{biblatex}
\usepackage[inkscapeformat=png]{svg} \usepackage[inkscapeformat=png]{svg}
\usepackage{booktabs,multirow,array} \usepackage{booktabs,multirow,array}
\usepackage{listings} \usepackage{listings}
@ -25,7 +25,7 @@
\usepackage{mathrsfs} \usepackage{mathrsfs}
\usetikzlibrary{shapes,arrows,positioning,arrows.meta} \usetikzlibrary{shapes,arrows,positioning,arrows.meta,calc}
\captionsetup[table]{skip=5pt} \captionsetup[table]{skip=5pt}
% Customize list of figures appearance in table of contents % Customize list of figures appearance in table of contents
@ -213,7 +213,7 @@ chapters/appendix%
\addcontentsline{toc}{chapter}{Bibliography} \addcontentsline{toc}{chapter}{Bibliography}
\nocite{*}
\printbibliography[title={References}] \printbibliography[title={References}]

View file

@ -40,6 +40,8 @@
\acro{PMF}[PMF]{Probability Mass Function } \acro{PMF}[PMF]{Probability Mass Function }
\acro{MSE}[MSE]{Mean Squared Error} \acro{MSE}[MSE]{Mean Squared Error}
\acro{GAN}[GAN]{generative adversarial network} \acro{GAN}[GAN]{generative adversarial network}
\acro{PIM}[PIM]{Product Information Management}
\acro{SKU}[SKU]{stock-keeping unit}
\end{acronym} \end{acronym}