\@writefile{toc}{\contentsline {subsubsection}{\numberline {\mbox {V-A}2}Cropping Images}{3}{subsubsection.5.1.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {\mbox {V-B}}Label App: Hentai Tinder}{3}{subsection.5.2}\protected@file@percent }
\newlabel{sec:impl_labelapp}{{\mbox {V-B}}{3}{Label App: Hentai Tinder}{subsection.5.2}{}}
+\@writefile{lol}{\contentsline {lstlisting}{csv/test1.csv}{4}{lstlisting.-1}\protected@file@percent }
+\@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces Structure of output file using comma separated values}}{4}{figure.4}\protected@file@percent }
+\newlabel{fig:csv}{{4}{4}{Structure of output file using comma separated values}{figure.4}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {5}{\ignorespaces Visualization of overfitting (Andrew Ng's Machine Learning Coursera class)}}{4}{figure.5}\protected@file@percent }
+\newlabel{fig:overfitting}{{5}{4}{Visualization of overfitting (Andrew Ng's Machine Learning Coursera class)}{figure.5}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {\mbox {V-C}}Deep Learning with fastai}{4}{subsection.5.3}\protected@file@percent }
+\newlabel{sec:impl_deeplearning}{{\mbox {V-C}}{4}{Deep Learning with fastai}{subsection.5.3}{}}
+\@writefile{toc}{\contentsline {section}{\numberline {VI}Results}{4}{section.6}\protected@file@percent }
+\newlabel{sec:results}{{VI}{4}{Results}{section.6}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {\mbox {VI-A}}Justifying Additional Transforms}{4}{subsection.6.1}\protected@file@percent }
+\@writefile{toc}{\contentsline {subsection}{\numberline {\mbox {VI-B}}Error Rate of Thighs}{4}{subsection.6.2}\protected@file@percent }
+\@writefile{lof}{\contentsline {figure}{\numberline {6}{\ignorespaces Training image without batch transforms}}{4}{figure.6}\protected@file@percent }
+\newlabel{fig:wobt}{{6}{4}{Training image without batch transforms}{figure.6}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {7}{\ignorespaces Training image with batch transforms}}{4}{figure.7}\protected@file@percent }
+\newlabel{fig:wbt}{{7}{4}{Training image with batch transforms}{figure.7}{}}
+\@writefile{lof}{\contentsline {figure}{\numberline {8}{\ignorespaces Comparing with and without batch transforms on error\_rate, train\_loss and valid\_loss}}{4}{figure.8}\protected@file@percent }
+\newlabel{fig:btgraph}{{8}{4}{Comparing with and without batch transforms on error\_rate, train\_loss and valid\_loss}{figure.8}{}}
+\@writefile{lot}{\contentsline {table}{\numberline {I}{\ignorespaces User stats}}{4}{table.1}\protected@file@percent }
+\newlabel{tab:user-table}{{I}{4}{User stats}{table.1}{}}
\bibdata{ref}
\bibcite{tkinter}{1}
\bibcite{zoom-advanced}{2}
\bibcite{machinelearning}{5}
\bibcite{thighdeology}{6}
\bibstyle{plain}
-\@writefile{lol}{\contentsline {lstlisting}{csv/test1.csv}{4}{lstlisting.-1}\protected@file@percent }
-\@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces Structure of output file using comma separated values}}{4}{figure.4}\protected@file@percent }
-\newlabel{fig:csv}{{4}{4}{Structure of output file using comma separated values}{figure.4}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {5}{\ignorespaces Training image without batch transforms}}{4}{figure.5}\protected@file@percent }
-\newlabel{fig:wobt}{{5}{4}{Training image without batch transforms}{figure.5}{}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {\mbox {V-C}}Deep Learning with fastai}{4}{subsection.5.3}\protected@file@percent }
-\newlabel{sec:impl_deeplearning}{{\mbox {V-C}}{4}{Deep Learning with fastai}{subsection.5.3}{}}
-\@writefile{toc}{\contentsline {section}{\numberline {VI}Results}{4}{section.6}\protected@file@percent }
-\newlabel{sec:results}{{VI}{4}{Results}{section.6}{}}
-\@writefile{toc}{\contentsline {section}{\numberline {VII}Discussion}{4}{section.7}\protected@file@percent }
-\newlabel{sec:discussion}{{VII}{4}{Discussion}{section.7}{}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {\mbox {VII-A}}Transforms}{4}{subsection.7.1}\protected@file@percent }
-\@writefile{toc}{\contentsline {subsection}{\numberline {\mbox {VII-B}}Limitations}{4}{subsection.7.2}\protected@file@percent }
-\newlabel{sec:limitations}{{\mbox {VII-B}}{4}{Limitations}{subsection.7.2}{}}
-\@writefile{toc}{\contentsline {subsection}{\numberline {\mbox {VII-C}}Future Work}{4}{subsection.7.3}\protected@file@percent }
-\newlabel{sec:futurework}{{\mbox {VII-C}}{4}{Future Work}{subsection.7.3}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {6}{\ignorespaces Training image with batch transforms}}{4}{figure.6}\protected@file@percent }
-\newlabel{fig:wbt}{{6}{4}{Training image with batch transforms}{figure.6}{}}
-\@writefile{lof}{\contentsline {figure}{\numberline {7}{\ignorespaces Comparing with and without batch transforms on error\_rate, train\_loss and valid\_loss}}{4}{figure.7}\protected@file@percent }
-\newlabel{fig:btgraph}{{7}{4}{Comparing with and without batch transforms on error\_rate, train\_loss and valid\_loss}{figure.7}{}}
-\@writefile{toc}{\contentsline {section}{\numberline {VIII}Conclusion}{4}{section.8}\protected@file@percent }
-\@writefile{toc}{\contentsline {section}{References}{4}{section*.2}\protected@file@percent }
+\@writefile{toc}{\contentsline {section}{\numberline {VII}Discussion}{5}{section.7}\protected@file@percent }
+\newlabel{sec:discussion}{{VII}{5}{Discussion}{section.7}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {\mbox {VII-A}}Limitations}{5}{subsection.7.1}\protected@file@percent }
+\newlabel{sec:limitations}{{\mbox {VII-A}}{5}{Limitations}{subsection.7.1}{}}
+\@writefile{toc}{\contentsline {subsection}{\numberline {\mbox {VII-B}}Future Work}{5}{subsection.7.2}\protected@file@percent }
+\newlabel{sec:futurework}{{\mbox {VII-B}}{5}{Future Work}{subsection.7.2}{}}
+\@writefile{toc}{\contentsline {section}{\numberline {VIII}Conclusion}{5}{section.8}\protected@file@percent }
+\@writefile{toc}{\contentsline {section}{References}{5}{section*.2}\protected@file@percent }
-This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2021.10.22) 21 MAR 2022 16:17
+This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2021.10.22) 27 MAY 2022 19:06
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
)
+LaTeX Warning: Citation `machinelearning' on page 1 undefined on input line 44.
+
+
+
+LaTeX Warning: Citation `deeplearning' on page 1 undefined on input line 50.
+
+
+
pdfTeX warning: pdflatex (file ./img/ai_diagram.pdf): PDF inclusion: found PDF
version <1.7>, but at most version <1.5> allowed
-<img/ai_diagram.pdf, id=101, 180.675pt x 188.6247pt>
+<img/ai_diagram.pdf, id=67, 180.675pt x 188.6247pt>
File: img/ai_diagram.pdf Graphic file (type pdf)
<use img/ai_diagram.pdf>
Package pdftex.def Info: img/ai_diagram.pdf used on input line 54.
<./img/ai_diagram.pdf>]
+LaTeX Warning: Citation `thighdeology' on page 2 undefined on input line 65.
+
+
+LaTeX Warning: Reference `sec:limitations' on page 2 undefined on input line 91
+.
+
+
+
pdfTeX warning: pdflatex (file ./img/thighs_diagram.drawio.pdf): PDF inclusion:
found PDF version <1.7>, but at most version <1.5> allowed
-<img/thighs_diagram.drawio.pdf, id=128, 578.16pt x 362.3136pt>
+<img/thighs_diagram.drawio.pdf, id=90, 578.16pt x 362.3136pt>
File: img/thighs_diagram.drawio.pdf Graphic file (type pdf)
<use img/thighs_diagram.drawio.pdf>
Package pdftex.def Info: img/thighs_diagram.drawio.pdf used on input line 123.
[]
[2]
+
+LaTeX Warning: Citation `fastai' on page 3 undefined on input line 133.
+
LaTeX Font Info: Trying to load font information for OT1+pcr on input line 1
-36.
- (/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1pcr.fd
+35.
+(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1pcr.fd
File: ot1pcr.fd 2001/06/04 font definitions for OT1/pcr.
)
-<img/data_sets.png, id=142, 778.91pt x 185.69376pt>
+<img/data_sets.png, id=102, 778.91pt x 185.69376pt>
File: img/data_sets.png Graphic file (type png)
<use img/data_sets.png>
-Package pdftex.def Info: img/data_sets.png used on input line 139.
+Package pdftex.def Info: img/data_sets.png used on input line 138.
(pdftex.def) Requested size: 258.0pt x 61.5058pt.
-Overfull \hbox (6.0pt too wide) in paragraph at lines 139--140
+Overfull \hbox (6.0pt too wide) in paragraph at lines 138--139
[][]
[]
-(./csv/test1.csv)
-<img/no_batch_transform1.png, id=149, 640.64343pt x 264.99pt>
+
+LaTeX Warning: Citation `zoom-advanced' on page 3 undefined on input line 154.
+
+
+LaTeX Warning: Citation `tkinter' on page 3 undefined on input line 159.
+
+
+LaTeX Warning: Reference `fig:csv' on page 3 undefined on input line 159.
+
+(./csv/test1.csv) [3 <./img/thighs_diagram.drawio.pdf> <./img/data_sets.png (PN
+G copy)>]
+
+LaTeX Warning: Reference `fig:overfitting' on page 4 undefined on input line 17
+7.
+
+
+LaTeX Warning: Reference `fig:wobt' on page 4 undefined on input line 177.
+
+
+LaTeX Warning: Reference `fig:wbt' on page 4 undefined on input line 177.
+
+
+LaTeX Warning: Reference `fig:btgraph' on page 4 undefined on input line 177.
+
+<img/overfitting.png, id=132, 470.35725pt x 177.0615pt>
+File: img/overfitting.png Graphic file (type png)
+<use img/overfitting.png>
+Package pdftex.def Info: img/overfitting.png used on input line 182.
+(pdftex.def) Requested size: 232.19843pt x 87.40929pt.
+<img/no_batch_transform1.png, id=133, 640.64343pt x 264.99pt>
File: img/no_batch_transform1.png Graphic file (type png)
<use img/no_batch_transform1.png>
-Package pdftex.def Info: img/no_batch_transform1.png used on input line 184.
+Package pdftex.def Info: img/no_batch_transform1.png used on input line 188.
(pdftex.def) Requested size: 232.19843pt x 96.04327pt.
- [3 <./img/thighs_diagram.drawio.pdf> <./img/data_sets.png (PNG copy)>]
-<img/with_batch_transform2.png, id=178, 640.64343pt x 264.99pt>
+<img/with_batch_transform2.png, id=135, 640.64343pt x 264.99pt>
File: img/with_batch_transform2.png Graphic file (type png)
<use img/with_batch_transform2.png>
-Package pdftex.def Info: img/with_batch_transform2.png used on input line 190.
+Package pdftex.def Info: img/with_batch_transform2.png used on input line 194.
(pdftex.def) Requested size: 232.19843pt x 96.04327pt.
-<img/with_vs_without_batch_transforms.png, id=179, 617.30624pt x 591.20876pt>
+<img/with_vs_without_batch_transforms.png, id=136, 617.30624pt x 591.20876pt>
File: img/with_vs_without_batch_transforms.png Graphic file (type png)
<use img/with_vs_without_batch_transforms.png>
Package pdftex.def Info: img/with_vs_without_batch_transforms.png used on inpu
-t line 197.
+t line 200.
(pdftex.def) Requested size: 258.0pt x 247.09715pt.
-Overfull \hbox (6.0pt too wide) in paragraph at lines 197--198
+Overfull \hbox (6.0pt too wide) in paragraph at lines 200--201
[][]
[]
-(./wAiFu.bbl)
+
+LaTeX Warning: Reference `tab:user-table' on page 4 undefined on input line 206
+.
+
+[4 <./img/overfitting.png> <./img/no_batch_transform1.png> <./img/with_batch_tr
+ansform2.png> <./img/with_vs_without_batch_transforms.png>] (./wAiFu.bbl)
** Conference Paper **
Before submitting the final camera ready copy, remember to:
uses only Type 1 fonts and that every step in the generation
process uses the appropriate paper size.
-Package atveryend Info: Empty hook `BeforeClearDocument' on input line 222.
-[4 <./img/no_batch_transform1.png> <./img/with_batch_transform2.png> <./img/wit
-h_vs_without_batch_transforms.png>]
-Package atveryend Info: Empty hook `AfterLastShipout' on input line 222.
+Package atveryend Info: Empty hook `BeforeClearDocument' on input line 238.
+[5
+
+]
+Package atveryend Info: Empty hook `AfterLastShipout' on input line 238.
(./wAiFu.aux)
-Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 222.
-Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 222.
-Package rerunfilecheck Info: File `wAiFu.out' has not changed.
-(rerunfilecheck) Checksum: C07E124E664826A7B943838FE9532B97;1347.
-Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 222.
+Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 238.
+Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 238.
+
+
+Package rerunfilecheck Warning: File `wAiFu.out' has changed.
+(rerunfilecheck) Rerun to get outlines right
+(rerunfilecheck) or use package `bookmark'.
+
+Package rerunfilecheck Info: Checksums for `wAiFu.out':
+(rerunfilecheck) Before: 7E971DB3A04553AE93750624CFB96505;908
+(rerunfilecheck) After: 607914959793BD1A383D08B0B432B5EB;1439.
+
+LaTeX Warning: There were undefined references.
+
+
+LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
+
+Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 238.
)
Here is how much of TeX's memory you used:
- 9446 strings out of 483183
- 139561 string characters out of 5966291
- 408952 words of memory out of 5000000
+ 9454 strings out of 483183
+ 139691 string characters out of 5966291
+ 414239 words of memory out of 5000000
24247 multiletter control sequences out of 15000+600000
- 577423 words of font info for 114 fonts, out of 8000000 for 9000
+ 579147 words of font info for 116 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
- 34i,11n,37p,1355b,1162s stack positions out of 5000i,500n,10000p,200000b,80000s
+ 34i,11n,37p,1355b,1164s stack positions out of 5000i,500n,10000p,200000b,80000s
{/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/share/texliv
e/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb></usr/share/texlive/texmf
-dist/fonts/type1/urw/courier/ucrr8a.pfb></usr/share/texlive/texmf-dist/fonts/t
ype1/urw/times/utmb8a.pfb></usr/share/texlive/texmf-dist/fonts/type1/urw/times/
utmbi8a.pfb></usr/share/texlive/texmf-dist/fonts/type1/urw/times/utmr8a.pfb></u
sr/share/texlive/texmf-dist/fonts/type1/urw/times/utmri8a.pfb>
-Output written on wAiFu.pdf (4 pages, 1304575 bytes).
+Output written on wAiFu.pdf (5 pages, 1373750 bytes).
PDF statistics:
- 238 PDF objects out of 1000 (max. 8388607)
- 203 compressed objects within 3 object streams
- 53 named destinations out of 1000 (max. 500000)
- 215 words of extra memory for PDF output out of 10000 (max. 10000000)
+ 221 PDF objects out of 1000 (max. 8388607)
+ 185 compressed objects within 2 object streams
+ 59 named destinations out of 1000 (max. 500000)
+ 156 words of extra memory for PDF output out of 10000 (max. 10000000)
\subsection{fastai} \label{sec:fastai}
The AI implementation is using fastai, a deep learning library providing machine learning practitioners with high-level components creating state-of-the-art results in standard deep learning domains~\cite{fastai}. For the purpose of boolean labeling in this project, a single-label classification structure is implemented using various building blocks. The pictures and their labels are loaded into a \emph{DataLoaders} object. This object is responsible for maching labels with images, applying item transforms (transforms applied to each image individually) and batch transforms (transforms applied to each batch during training). It is also responsible of splitting the dataset into various sets: \emph{training, validation} and \emph{testing} (see Figure~\ref{fig:data_sets}). The training set is used to train a given model, which sees and learns from this data. The validation set is used to provide an unbiased evaluation of a model fit on the training dataset while tuning model hyperparameters. The evaluation becomes more biased as skill on the validation dataset is incorporated into the model configuration. Unlike the training set, the model only occasionally sees this data but never learns from it. The testing set is used to provide an unbiased evaluation of a \emph{final model fit} of the training dataset.
-% Add something about how fastai loads and splits the dataset using ImageDataLoader
The DataLoaders object is then combined with a model and a metric to create a \emph{Learner} object. The model can be pre-trained, which means that some object and shape recognition can be used as a foundation to train a model for a more specific computer vision problem. This method is called \emph{transfer learning}. The Learner object has a bunch of methods including: \texttt{fine\_tune}, \texttt{predict} and \texttt{export}. The \texttt{fine\_tune} method first freezes all layers except the last one for one cycle (a ``prequel'' epoch), and then unfreezes all layers before running the epochs. This process of freezing and unfreezing layers in the Convolutional Neural Network improves the performance of transfer learning. So using \texttt{fine\_tune(2)} would first run a cycle only adjusting the last layer, then run 2 epochs adjusting all layers. The \texttt{predict} method is simply loading a single image into the model which then predicts the label. This is usually done after the training to sample the accuracy of the model. The \texttt{export} method saves the trained model to a file.
The code is open source and can be found at: \url{https://git.hentai-ai.org/?p=hentai-tinder.git/.git}
\subsection{Deep Learning with fastai} \label{sec:impl_deeplearning}
-% How was fastai implemented, using colab and google drive
-% Add git link
+The deep learning framework (fastai) was implemented using interactive python notebooks running on Google Colab\footnote{url{https://colab.research.google.com}} connected to Google Drive\footnote{\url{https://drive.google.com}} for storing csv-files, dataset and trained models.
+The notebook is open source and can be found at: \url{https://git.hentai-ai.org/?p=waifu-notebook.git/.git}
+% TODO add to git
\section{Results} \label{sec:results}
-% Two additional csv files, decriptive statistics
-% Cool graphs of AI performance
+\subsection{Justifying Additional Transforms}
+One of the main observations when training on such a small dataset was the tendency to overfitting (see Figure~\ref{fig:overfitting}). There are two types of transformations applied to the dataset before training: \texttt{item\_tfms} and \texttt{batch\_tfms}. The item\_tfms for this implementation is using \textit{RandomResizedCrop} which will crop every image randomly to 224x244 with a minimum scaling of 0.75. The batch\_tfms is applying many more tranformations to images in batches between each epoch. These transformations include: zooming, flipping, rotating and changing the brightness. Figure~\ref{fig:wobt} shows how \emph{only} item\_tfms transform the dataset. Figure~\ref{fig:wbt} shows how batch\_tfms additionally transforms the dataset further. Figure~\ref{fig:btgraph} shows the batch\_tfms's effect on error\_rate, train\_loss and valid\_loss.
-\section{Discussion} \label{sec:discussion}
-\subsection{Transforms}
-% Explain what the difference between item_transforma and batch_transform is.
+
+
+\begin{figure}
+ \fbox{\includegraphics[width=.45\textwidth]{img/overfitting.png}}
+ \caption{Visualization of overfitting (Andrew Ng's Machine Learning Coursera class)}
+ \label{fig:overfitting}
+\end{figure}
\begin{figure}
\fbox{\includegraphics[width=.45\textwidth]{img/no_batch_transform1.png}}
\label{fig:wbt}
\end{figure}
-% Compare with/-out transforms, graph of train_loss, valid_loss and error_rate, 15 epochs
\begin{figure}
\includegraphics[width=.5\textwidth]{img/with_vs_without_batch_transforms.png}
\caption{Comparing with and without batch transforms on error\_rate, train\_loss and valid\_loss}
\label{fig:btgraph}
\end{figure}
-\subsection{Limitations} \label{sec:limitations}
-The size of the lewd anime thighs dataset is only 1000 images.
-This leads to overfitting which can be mitigated by applying transformations
-The small dataset is due to the time-consuming task of manually cropping and labeling the dataset. Since the model is trying to learn an individual's taste, that individual must label the full dataset.
+\subsection{Error Rate of Thighs}
+The dataset containing 1000 images was labled using Hentai Tinder (Section~\ref{sec:impl_labelapp}) by three individual persons: User A, User B and User C. A table of the result for each user can be seen in Table~\ref{tab:user-table}. The three different users had varying rates of approval on the dataset with user C liking almost half of the dataset. The lowest error\_rate observed came from the dataset labled by user B. With the error\_rate being close to the rate of approval, a sanity check with a confusion matrix showed that the model did not just predict false on the whole dataset.
+
+\begin{table}
+\centering
+\begin{tabular}{l|cccccc}
+ User & Approved & valid err & TP & FP & TN & FN & test err\\ \hline
+ A & 33.00\% & 26.87\% & 31 & 19 & 116 & 34 \\
+ B & 13.22\% & 22\% & 1 & 6 & 76 & 16 \\
+ C & 49.30\% & 28.36\% & 72 & 22 & 72 & 34
+\end{tabular}
+\caption{User stats}
+\label{tab:user-table}
+\end{table}
-If only 15\% of the dataset is labeled as True, and the model is incapable of getting past 15\% error rate, this could be a sign of the model just trying to say False on every single image... This can be verified using a confusion matrix!
+\section{Discussion} \label{sec:discussion}
+
+\subsection{Limitations} \label{sec:limitations}
+The size of the lewd anime thighs dataset is only 1000 images. This leads to overfitting on the training or the validation set which can be mitigated slightly by applying transformations. The small dataset is due to the time-consuming task of manually cropping and labeling the dataset. Since the model is trying to learn an individual's taste, that individual must label the full dataset.
\subsection{Future Work} \label{sec:futurework}
In order to increase the size of the dataset and thereby obtaining a more robust accuracy from the machine learning model, future research in Project Hentai AI will spend some more focus on automating the collection, transformation and labeling of data.