Apparatus and method for classifying immoral images using deep learning technology
Disclosed is an apparatus for classifying immoral images according to one embodiment of the present invention, comprising: a text encoder unit that receives a learning text as an input to create a textual embedding vector; an image encoder unit that receives an image as an input to create a visual embedding vector; and a morality classification unit that receives either the textual embedding vector or the visual embedding vector as an input to create and output a classification result indicating whether the input text or image is moral or immoral, wherein the morality classification unit learns the classification results of the input learning texts only from a learning dataset containing a plurality of learning texts in which whether each learning text is moral or immoral is mapped to a binary class.
1 . An apparatus for classifying immoral, images comprising:
a text encoder unit that receives a learning text as an input to create a textual embedding vector;
an image encoder unit that receives an image as an input to create a visual embedding vector; and
a morality classification unit that receives either the textual embedding vector or the visual embedding vector as an input to create and output a classification result indicating whether the input text or image is moral or immoral,
wherein the morality classification unit learns the classification results of the input learning texts by receiving only the textual embedding vector created from the learning text included in a learning dataset containing a plurality of learning texts in which whether each learning text is moral or immoral is mapped to a binary class,
wherein, after the learning, the morality classification unit classifies an executable image by applying the learned classification to the visual embedding vector generated by the image encoder unit without retraining using image data, and
wherein the morality classification unit performs a learning process using a loss function (Lc) represented by the following equation:
Loss
Function
(
Lc
)
=
-
1
n
∑
i
=
1
n
log
σ
(
y
^
i
)
+
(
-
y
i
)
log
(
1
-
σ
(
y
^
i
)
)
,
where n is the number of texts in a minibatch, y is a one-hot vector in which only the ground-truth label is 1 and the others are 0, ŷ is the classification result output by the morality classification unit from the input textual embedding vector, and σ is a sigmoid function.
2 . The apparatus for classifying immoral images of claim 1 , wherein the text encoder unit is a text encoder based on a contrastive language-image pre-training (CLIP) model, which maps a pair of text and corresponding image to the same embedding space.
3 . The apparatus for classifying immoral images of claim 2 , wherein the textual embedding vector is an embedding vector in a joint embedding space to which a feature or feature vector of the input text and a feature or feature vector of the corresponding image are matched and mapped.
4 . The apparatus for classifying immoral images of claim 1 , wherein the image encoder unit is an image encoder based on a contrastive language-image pre-training (CLIP) model, which maps a pair of text and corresponding image to the same embedding space.
5 . The apparatus for classifying immoral images of claim 4 , wherein the visual embedding vector is an embedding vector in a joint embedding space to which a feature or feature vector of the input image and a feature or feature vector of the corresponding text are matched and mapped.
6 . The apparatus for classifying immoral images of claim 1 , wherein the morality classification unit comprises a multi-layer perceptron (MLP) including a plurality of fully connected layers.
7 . The apparatus for classifying immoral images of claim 6 , wherein the plurality of fully connected layers comprises Dropout Layer-Linear Layer-Tanh Layer-Dropout Layer-Projection Layer.
8 . A method for classifying immoral images, performed by an apparatus comprising a processor and a memory, the method comprising:
a first step of receiving a learning dataset as an input to create a textual embedding vector and performing a learning process by receiving only the created textual embedding vector to output a classification result indicating whether a learning text contained in the learning dataset is moral or immoral,
wherein the learning process is carried out in the direction of minimizing a loss function (Lc); and
a second step of receiving an executable image to output a classification result indicating whether the executable image is moral or immoral,
wherein the classification of the executable image is performed by applying the learning process to a visual embedding vector corresponding to the executable image without training on image data,
wherein the learning dataset contains only a plurality of learning texts in which whether each learning text is moral or immoral is mapped to a binary class,
and
wherein the loss function (Lc) is as follows:
Loss
Function
(
Lc
)
=
-
1
n
∑
i
=
1
n
log
σ
(
y
^
i
)
+
(
-
y
i
)
log
(
1
-
σ
(
y
^
i
)
)
,
where n is the number of texts in a minibatch, y is a one-hot vector in which only the ground-truth label is 1 and the others are 0, ŷ is the classification result output by the apparatus from the input textual embedding vector, and σ is a sigmoid function.
9 . A computer program stored on a non-transitory computer-readable medium, when executed on a computing device, performing:
a first step of receiving a learning dataset as an input to create a textual embedding vector and performing a learning process by receiving only the created textual embedding vector to output a classification result indicating whether a learning text contained in the learning dataset is moral or immoral, wherein the learning process is carried out in the direction of minimizing a loss function (Lc); and
a second step of receiving an executable image to output a classification result indicating whether the executable image is moral or immoral,
wherein the classification result for the executable image is generated by reusing the learning performed on textual embedding vectors without retraining using image data,
wherein the learning dataset contains only a plurality of learning texts in which whether each learning text is moral or immoral is mapped to a binary class,
and
wherein the loss function (Lc) is as follows:
Loss
Function
(
Lc
)
=
-
1
n
∑
i
=
1
n
log
σ
(
y
^
i
)
+
(
-
y
i
)
log
(
1
-
σ
(
y
^
i
)
)
,
where n is the number of texts in a minibatch, y is a one-hot vector in which only the ground-truth label is 1 and the others are 0, ŷ is the classification result output by the computer program from the input textual embedding vector, and σ is a sigmoid function.