Skip to content
Snippets Groups Projects
Commit a34c5891 authored by Rony Abecidan's avatar Rony Abecidan
Browse files

[Update and Add] : Update of INSTALL, create_domains and simulation + Adding of the slides

parent a20ad022
No related branches found
No related tags found
No related merge requests found
......@@ -181,7 +181,7 @@ def save_results(acc_test,hyperparameters):
target : {hyperparameters['target_name']}
--- DATA ---
source : 30000 images sampled from the "Splicing" category of the database DEFACTO
source : random half images sampled from the "Splicing" category of the database DEFACTO
repartition : 1-1/{hyperparameters['N_fold']} 1/{hyperparameters['N_fold']}
A {hyperparameters['N_fold']}-fold cutting is applied to the source to split it into {hyperparameters['N_fold']} train and test sets
......@@ -214,7 +214,6 @@ def save_results(acc_test,hyperparameters):
results+=f"{hyperparameters['domain_names'][j]} : {np.round(np.mean(acc_test[:,j]),3)*100}% +/- {np.round(np.std(acc_test[:,j]),2)*100}%"
results+="\n"
with open(f"Results/{folder_path}/{filename}.txt", "w") as file:
file.write(description+results)
......@@ -234,10 +233,6 @@ def save_hyperparameters(hyperparameters):
def train_detector(hyperparameters,acc_targets_global,i,mix=None):
if mix is None:
mix=('mix' in hyperparameters['precisions'])
batch_size=hyperparameters['train_batch_size']
source_path=hyperparameters['source_path']
target_path=hyperparameters['target_path']
......@@ -322,10 +317,8 @@ def train_detector(hyperparameters,acc_targets_global,i,mix=None):
def simulate(hyperparameters):
folder_path=f"{hyperparameters['setup']}-{hyperparameters['precisions']}"
acc_targets_global = []
sigmas=[]
save_hyperparameters(hyperparameters)
......
......@@ -51,3 +51,80 @@ from the filenames of the source and the target. For instance SrcOnly(None --> Q
The function `initialize_hyperparameters` in `utils.py` can help. If you want to test the Update setup, please note that you need to precise the bandwiths used for each kernel in a list just like that `hyperparameters['sigmas']=[8,8,8]`.
In order to better realize how things work here you can have a look on the notebook [Demo.ipynb](./Demo.ipynb)
At the end, the files should be organized like that :
```
unsupervisedjpegdomainadaptation/
└── DEFACTO/
├── Splicing/
├── 1
├── img
├── probe_mask
├── .
├── .
├── .
├── 7
├── img
├── probe_mask
├── .
├── .
├── .
├── Swapping
└── All_splicing/
├── img
├── probe_mask
└── Domains/
├── Sources/
├── source-none.hdf5
├── source-qf(5).hdf5
├── source-qf(100).hdf5
├── Targets/
├── target-none.hdf5
├── target-qf(5).hdf5
├── target-qf(10).hdf5
├── target-qf(20).hdf5
├── target-qf(50).hdf5
├── target-qf(100).hdf5
└── Experiments/
├── Results/
├── SrcOnly-s=none_t=qf(5)
├── .
├── .
├── .
├── utils.py
├── simulations.py
├──code_to_experiment.txt
└── Slides/
├── Wifs2021_Presentation.pdf
└── create_database.py
└── create_domains.py
└── data_pipeline.py
└── Demo.ipynb
└── filenames_img.txt
└── requirements.txt
```
\ No newline at end of file
File added
......@@ -50,10 +50,7 @@ def return_filenames(folder_name):
return filenames
img_folder='img'
mask_folder='probe_mask'
addrs=return_filenames(img_folder)
addrs_masks=return_filenames(mask_folder)
def is_real(mask):
m = np.sum(mask)
......@@ -149,7 +146,7 @@ def save_base(domain_type,name,transformation=None,patch_size=128,nb_split=3,see
np.random.seed(seed)
final_addrs=np.random.choice(a=addrs, size=size, replace=False)
assert (domain_type=='Source' or domain_type=='Target'), "you should as a dataset 'Source' or 'Target' "
assert (domain_type=='Source' or domain_type=='Target'), "you should name the domain type as 'Source' or 'Target' "
if domain_type=='Source':
dataset=final_addrs[0:size//2]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment