{"cells":[{"metadata":{},"cell_type":"markdown","source":"# LEts Start First with What Is Steganography ?\nSteganography  is  to  conceal  the  secret  data  within  multimedia contents such as file, message, image, or video. Steganography is concerned  with concealing the fact that  the  secret data  is being sent covertly as well as concealing the contents of the secret data .  Steganalysis  is  the  counter  part  of  steganography  that defined as the art of science of detecting the hidden secret data in cover objects. In other words, steganalysis is to detect secret data hidden  using  steganography,  where  steganalysis  is  to  identify suspected  packages,  determine  whether  the  secret  data  is embedded  or  not .  Machine learning  is  a  field  of  artificial intelligence  to  provide  the  ability  to  learn  without  being programmed and deep learning is a subset of machine learning .    In this paper, steganalysis and machine learning  techniques are explained and the process and possibility for steganalysis in various  machine  learning  frameworks  are  described.  Some datasets  on  stego-images  are  prepared  and  training  model  are tested. "},{"metadata":{},"cell_type":"markdown","source":"# What is Actually Stegnanalysis ?\n\nStegnanalysis is the art of secret communication and steganalysis is the art of detecting the hidden messages embedded in digital media using steganography. Both steganography and steganalysis have received a great deal of attention from law enforcement and the media. In the past years many powerful and robust methods of steganography and steganalysis have been reported in the literature. In this paper, we classify and give an account of the various approaches that have been proposed for steganalysis. Some promising methods for statistical steganalysis have also been identified."},{"metadata":{},"cell_type":"markdown","source":"\n<img src=\"https://www.researchgate.net/profile/Bismita_Choudhury/publication/282889667/figure/fig1/AS:614435383152640@1523504219027/Block-diagram-of-Steganalysis.png\">","attachments":{}},{"metadata":{},"cell_type":"markdown","source":"**Steganalysis** is to identify suspected data, determine hidden data, and recover the hidden data. Steganalysis can be divided into **four** categories: \n- visual \n- structural \n- statistical \n- learning steganalysis.  \n\n**Visual steganalysis** is to investigate visual artifacts in the stego-images, where try to catch visual difference by analyzing stego-images. \n\n**Structural steganalysis** looks  into suspected signs in the media  format  representation  since  the  format  is  often  changed when  the  secret  message  is  embedded.  RS  analysis  and  pair analysis  are  included  in  the  structural  steganalysis.\n\n**Statistical steganalysis**  utilizes  statistical  models  to  detect  steganography techniques.  Statistical  steganalysis  can  be  divided  into  specific statistical  and  universal  statistical  steganalysis.\n\n**Learning steganalysis**  also  called  blind  steganalysis  is  one  of  universal statistical  steganalysis  since  cover  images  and  stego-images  are used as training datasets.  Other  classification  of  steganalysis  can  be  divided  into  six categories . It is depending on what kind of attacks a forensic examiner uses.  "},{"metadata":{},"cell_type":"markdown","source":"# EDA Stegnanalysis"},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport imageio\nimport matplotlib.pyplot as plt\nimport matplotlib.image as mpimg\nimport torch\n","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"PATH = '/kaggle/input/alaska2-image-steganalysis'\nmodel = '/kaggle/input/alaska2-image-steganalysis/e4s-srm/'\n\ntrain_images = pd.Series(os.listdir(PATH + '/Cover/')).sort_values(ascending=True).reset_index(drop=True)\ntest_images = pd.Series(os.listdir(PATH + '/Test')).sort_values(ascending=True).reset_index(drop=True)\nsample_submission = pd.read_csv(f'{PATH}/sample_submission.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"es4 = .alexnet(pretrained=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"sample_submission.head()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Display Images"},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(nrows=2, ncols=4, figsize=(16, 8))\nk=0\nfor i, row in enumerate(ax):\n    for j, col in enumerate(row):\n        img = mpimg.imread(PATH + '/Cover/' + train_images[k])\n        col.imshow(img)\n        col.set_title(train_images[k])\n        k=k+1\nplt.suptitle('Samples from Cover Images', fontsize=14)\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fig, ax = plt.subplots(nrows=2, ncols=4, figsize=(16, 8))\nk=0\nfor i, row in enumerate(ax):\n    for j, col in enumerate(row):\n        img = mpimg.imread(PATH + '/Test/' + test_images[k])\n        col.imshow(img)\n        col.set_title(test_images[k])\n        k=k+1\nplt.suptitle('Samples from Test Images', fontsize=14)\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"for folder in os.listdir(PATH):\n    try:\n        print(f\"Folder {folder} contains {len(os.listdir(PATH + '/' + folder))} images.\")\n    except:\n        print(f'{folder}')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Displaying JMiPOD , JUNIWARD , UERD, with train"},{"metadata":{"trusted":true},"cell_type":"code","source":"folders = ['Cover', 'JMiPOD', 'JUNIWARD', 'UERD']\nk=0\nimg_cover = mpimg.imread(PATH + '/' + folders[0] + '/'+ train_images[k])\nimg_jmipod = mpimg.imread(PATH + '/' + folders[1] + '/'+ train_images[k])\nimg_juniward = mpimg.imread(PATH + '/' + folders[2] + '/'+ train_images[k])\nimg_uerd = mpimg.imread(PATH + '/' + folders[3] + '/'+ train_images[k])\n\nfig, ax = plt.subplots(nrows=3, ncols=4, figsize=(16, 12))\n\nax[0,0].imshow(img_jmipod)\nax[0,1].imshow((img_cover == img_jmipod).astype(int)[:,:,0])\nax[0,1].set_title(f'{train_images[k]} Channel 0')\n\nax[0,2].imshow((img_cover == img_jmipod).astype(int)[:,:,1])\nax[0,2].set_title(f'{train_images[k]} Channel 1')\nax[0,3].imshow((img_cover == img_jmipod).astype(int)[:,:,2])\nax[0,3].set_title(f'{train_images[k]} Channel 2')\nax[0,0].set_ylabel(folders[1], rotation=90, size='large', fontsize=14)\n\n\nax[1,0].imshow(img_juniward)\nax[1,1].imshow((img_cover == img_juniward).astype(int)[:,:,0])\nax[1,2].imshow((img_cover == img_juniward).astype(int)[:,:,1])\nax[1,3].imshow((img_cover == img_juniward).astype(int)[:,:,2])\nax[1,0].set_ylabel(folders[2], rotation=90, size='large', fontsize=14)\n\nax[2,0].imshow(img_uerd)\nax[2,1].imshow((img_cover == img_uerd).astype(int)[:,:,0])\nax[2,2].imshow((img_cover == img_uerd).astype(int)[:,:,1])\nax[2,3].imshow((img_cover == img_uerd).astype(int)[:,:,2])\nax[2,0].set_ylabel(folders[3], rotation=90, size='large', fontsize=14)\n\nplt.suptitle('Pixel Deviation from Cover Image', fontsize=14)\n\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Total number of images"},{"metadata":{"trusted":true},"cell_type":"code","source":"print('{} images with Cover Images '.format(train_images.nunique()))\nprint('{} images with Test Images '.format(test_images.nunique()))\n\n","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":4}