Steganalysis/PhaseAwareNet_SRC/Caffe/HG_IMDB_JUNI04_Create.ipynb

123 lines
3.2 KiB
Plaintext
Raw Normal View History

2021-12-30 11:48:37 +00:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[HG:] Train Set = 30000, Test = 10000\n"
]
}
],
"source": [
"import numpy as np\n",
"import os\n",
"\n",
"import sys\n",
"\n",
"\n",
"N_TRN = 5000\n",
"N_TST = 5000\n",
"\n",
"DataBaseFolder = '/home/mchen/tmp/caffe/data/JStego/'\n",
"\n",
"BOSS2CoverPath = os.path.join( DataBaseFolder, '75') # BOSS2 cover subfolder\n",
"BOSS2StegoPath = os.path.join( DataBaseFolder, 'JUNI_0.4') # BOSS2 stego subfolder\n",
"\n",
"BOW2CoverPath = os.path.join( DataBaseFolder, 'BOWS2_75') # BOWS cover subfolder\n",
"BOW2StegoPath = os.path.join( DataBaseFolder, 'BOWS2_JUNI_0.4') # BOWS stego subfolder\n",
"\n",
"TxtListFolder = '/home/mchen/tmp/caffe/data/JStego/MiracleList/'\n",
"\n",
"np.random.seed(0) # reset the random seed\n",
"\n",
"RandomImages = np.random.permutation(10000) + 1\n",
"\n",
"print (\"[HG:] Train Set = %d, Test = %d\"%( 20000 + N_TRN * 2, N_TST * 2 ) )"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"with open('{}/train.txt'.format(TxtListFolder), 'w') as f:\n",
" for idx in range(N_TRN):\n",
" imageName = str( RandomImages[idx] ) + '.jpg'\n",
" f.write('{} 0\\n'.format(BOSS2CoverPath + '/' + imageName ) )\n",
" f.write('{} 1\\n'.format(BOSS2StegoPath + '/' + imageName ) )\n",
" \n",
" for idx in range(10000):\n",
" imageName = str( RandomImages[idx] ) + '.jpg'\n",
" f.write('{} 0\\n'.format(BOW2CoverPath + '/' + imageName ) )\n",
" f.write('{} 1\\n'.format(BOW2StegoPath + '/' + imageName ) ) \n",
" \n",
" f.close()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"with open('{}/test.txt'.format(TxtListFolder), 'w') as f:\n",
" for idx in range(N_TST):\n",
" imageName = str( RandomImages[N_TRN + idx] ) + '.jpg'\n",
" f.write('{} 0\\n'.format(BOSS2CoverPath + '/' + imageName ) )\n",
" f.write('{} 1\\n'.format(BOSS2StegoPath + '/' + imageName ) )\n",
" f.close()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 1
}