diff --git a/mdata/ILSVRC.py b/mdata/ILSVRC.py index c1dfa1f..ed04903 100644 --- a/mdata/ILSVRC.py +++ b/mdata/ILSVRC.py @@ -33,7 +33,8 @@ package_dir = os.path.dirname(os.path.abspath(__file__)) class DataILSVRC(DataDumperBase): - def __init__(self, base_dir='/media/chunk/Elements/D/data/ImageNet/img/ILSVRC2013_DET_val', category='Train'): + def __init__(self, base_dir='/media/chunk/Elements/D/data/ImageNet/img/ILSVRC2013_DET_val', category='Train', + host='HPC-server'): DataDumperBase.__init__(self, base_dir, category) self.base_dir = base_dir @@ -45,6 +46,10 @@ class DataILSVRC(DataDumperBase): self.feat_dir = os.path.join(self.dst_dir, 'Feat') self.img_dir = os.path.join(self.dst_dir, 'Img') + self.host = host + self.master = 'spark://%s:7077' % self.host + self.appname = 'ImageILSVRC' + self.dict_data = {} self.table_name = self.base_dir.strip('/').split('/')[-1] + '-' + self.category @@ -316,7 +321,7 @@ class DataILSVRC(DataDumperBase): return self.table if self.connection is None: - c = happybase.Connection('HPC-server') + c = happybase.Connection(host=self.host) self.connection = c tables = self.connection.tables() @@ -345,7 +350,7 @@ class DataILSVRC(DataDumperBase): table_name = self.table_name if self.connection is None: - c = happybase.Connection('HPC-server') + c = happybase.Connection(host=self.host) self.connection = c tables = self.connection.tables() @@ -506,7 +511,7 @@ class DataILSVRC(DataDumperBase): elif mode == "spark": # cluster if self.sparker == None: - self.sparker = SC.Sparker(host='HPC-server', appname='ImageCV', master='spark://HPC-server:7077') + self.sparker = SC.Sparker(host=self.host, appname=self.appname, master=self.master) result = self.sparker.read_hbase(self.table_name) # result = {key:[feat,tag],...} for feat, tag in result: diff --git a/mdata/ILSVRC_S.py b/mdata/ILSVRC_S.py index e98089a..1734990 100644 --- a/mdata/ILSVRC_S.py +++ b/mdata/ILSVRC_S.py @@ -39,7 +39,7 @@ class DataILSVRC_S(DataDumperBase): copyright(c) 2015 chunkplus@gmail.com """ - def __init__(self, base='ILSVRC2013_DET_val', category='Train_1', tablename=None): + def __init__(self, base='ILSVRC2013_DET_val', category='Train_1', host='HPC-server', tablename=None): DataDumperBase.__init__(self, base, category) self.base = base @@ -55,8 +55,11 @@ class DataILSVRC_S(DataDumperBase): else: self.table_name = tablename - self.sparker = SC.Sparker(host='HPC-server', appname='ImageILSVRC-S', - master='spark://HPC-server:7077') + self.host = host + self.master = 'spark://%s:7077' % self.host + self.appname = 'ImageILSVRC-S' + self.sparker = SC.Sparker(host=self.host, appname=self.appname, + master=self.master) self.steger = F5.F5(sample_key, 1) @@ -67,7 +70,7 @@ class DataILSVRC_S(DataDumperBase): return self.table if self.connection is None: - c = happybase.Connection('HPC-server') + c = happybase.Connection(host=self.host) self.connection = c tables = self.connection.tables() @@ -91,7 +94,7 @@ class DataILSVRC_S(DataDumperBase): table_name = self.table_name if self.connection is None: - c = happybase.Connection('HPC-server') + c = happybase.Connection(host=self.host) self.connection = c tables = self.connection.tables() @@ -251,8 +254,8 @@ class DataILSVRC_S(DataDumperBase): elif mode == 'spark': if self.sparker == None: - self.sparker = SC.Sparker(host='HPC-server', appname='ImageILSVRC-S', - master='spark://HPC-server:7077') + self.sparker = SC.Sparker(host=self.host, appname=self.appname, + master=self.master) cols = [ 'cf_pic:data', @@ -285,8 +288,8 @@ class DataILSVRC_S(DataDumperBase): withdata=withdata) elif mode == 'analysis': if self.sparker == None: - self.sparker = SC.Sparker(host='HPC-server', appname='ImageILSVRC-S', - master='spark://HPC-server:7077') + self.sparker = SC.Sparker(host=self.host, appname=self.appname, + master=self.master) cols = [ 'cf_pic:data', @@ -401,8 +404,8 @@ class DataILSVRC_S(DataDumperBase): elif mode == 'spark': if self.sparker == None: - self.sparker = SC.Sparker(host='HPC-server', appname='ImageILSVRC-S', - master='spark://HPC-server:7077') + self.sparker = SC.Sparker(host=self.host, appname=self.appname, + master=self.master) cols = [ 'cf_pic:data', @@ -496,8 +499,8 @@ class DataILSVRC_S(DataDumperBase): elif mode == 'spark': if self.sparker == None: - self.sparker = SC.Sparker(host='HPC-server', appname='ImageILSVRC-S', - master='spark://HPC-server:7077') + self.sparker = SC.Sparker(host=self.host, appname=self.appname, + master=self.master) cols = [ 'cf_pic:data', @@ -532,8 +535,8 @@ class DataILSVRC_S(DataDumperBase): def _analysis(self, mode='analysis', feattype='ibd', readforward=False, writeback=True, withdata=False): if mode == 'analysis': if self.sparker == None: - self.sparker = SC.Sparker(host='HPC-server', appname='ImageILSVRC-S', - master='spark://HPC-server:7077') + self.sparker = SC.Sparker(host=self.host, appname=self.appname, + master=self.master) cols = [ 'cf_pic:data', @@ -618,8 +621,8 @@ class DataILSVRC_S(DataDumperBase): elif mode == "spark" or mode == "cluster": if self.sparker == None: - self.sparker = SC.Sparker(host='HPC-server', appname='ImageILSVRC-S', - master='spark://HPC-server:7077') + self.sparker = SC.Sparker(host=self.host, appname=self.appname, + master=self.master) rdd_dataset = self.sparker.read_hbase(self.table_name, func=rdd.rddparse_dataset_ILS, collect=False) if not collect: diff --git a/msteg/steganalysis/ChiSquare.py b/msteg/steganalysis/ChiSquare.py deleted file mode 100644 index 7d0bb2c..0000000 --- a/msteg/steganalysis/ChiSquare.py +++ /dev/null @@ -1,162 +0,0 @@ -""" -
-This module implements an algorithm described by Andreas Westfeld in [1,2], -which detects if there was data embedded into an image using JSteg. -It uses the property that JSteg generates pairs of values in the -DCT-coefficients histogram, which can be detected by a \chi^2 test. -
- --[1]: Andreas Westfeld, F5 - A Steganographic Algorithm High Capacity Despite -Better Steganalysis -[2]: Andreas Westfeld, Angriffe auf steganographische Systeme --""" - -from collections import defaultdict -import os - -from PIL import Image -import numpy -from scipy.stats import chisquare -import matplotlib.pyplot as plt -import itertools as it - -from .. import * - - -class ChiSquare(StegBase): - """ - The module contains only one method, detect. - """ - - def __init__(self, ui, core): - self.ui = ui - self.core = core - - def detect(self, src, tgt, tgt2): - """ -
- Detect if there was data embedded in the source image image with - JSteg algorithm. -
- -- Parameters: -
Source imageImage which should be tested
Target imageImage which displays a graphic with the - embedding probability
2nd Target imageImage which displays the embedding - positions in the image