我們提出了一種半監督式的二元分類卷積網路,它結合了變分自動編碼器和深度卷積生成對抗網路,利用原始影像和生成影像的相似度來判斷類別。由於訓練時只需要使用其中一類的影像,因此這個方法不受類別之間數量差距的影響,適合用來做不平衡數據的分類。 我們在這個系統中,對生成對抗網路做了兩類型的改進,第一類型是讓生成對抗網路的訓練更為穩定的改進。眾所皆知生成對抗網路效果好,但難訓練;除了很有可能遇到梯度消失或梯度爆炸等問題外,也很容易遇到模式坍塌,也就是生成影像缺乏多樣性的問題。第二類型的改進是讓生成對抗網路能夠學習到更好的特徵,使得它生成出來的影像能夠盡可能的接近訓練過的類別;即使輸入的影像不屬於訓練過的類別,也會生成類似訓練過的類別。 在實驗中,我們以電子元件的X光影像為例,使用上述所提的系統再加上一個簡單的判定式來計算原始影像和生成影像的相似度,最後在每個類別上都能得到接近94%的正確率。;We propose a semi-supervised convolutional neural network for binary classification, which combines variational autoencoder with generative adversarial network (GAN) to classify similar objects by thresholding the similarities between original images and generated images. Since we only use one-kind samples from the multi-class samples to train the model, this method won’t be affected by the imbalanced data; it means the method is suitable for imbalance data classification. There are two kinds of improvements in the proposed system, the first one is to improve the training stability of the GAN. It’s well-known that GANs are effective, but training GANs is hard since gradient vanishing, gradient exploding, and mode collapse could be encountered very easily. The second kind of improvements is to make GANs learning better features so that any generated image could look as close as possible to the trained class, even if the input images do not belong to the trained class. We used X-ray images of electronic components as examples in our experiment. We got nearly 94% true positive rate for every classes by using a simple similarity criterion.