I was curious about FFCC(Fast Fourier Color Constancy). However, the original version is based on Linux. The issuses of Pathes stops from running the inital code smoothly. I take down the process of modify code in case you encounter the same problems.
Firstly download Fast Fourier Color Constancy Matlab Toolbox and minFunc library from Mark Schmidt.
- MATLAB 2023b
- Windows 11
- focus on the cross-camera (agnostic) performance, modify the code can test the performance of the ffcc model trained by Cam A on the Cam B dataset.
- statistic results of cross-validation.
- When tuning hyperparamter for new Dataset, run
Tune_mainfunc.minstead of. ChangeTune.mline 8andline 9to set DataSet. - When test (cross-validation), run
Test_CV_main.m. Changeline 11-13to set the model and test DataSet.NameLabelis easy to distinguish different DataSet, for example Gehler-Shi or NUS.
NameCamdstyou can regard as the test dataset that might be agnostic to the model. whenstrcmp(NameCamdst, NameCamsrc) == 1, test dataset and train dataset are from the same domain.
NameCamsrcyou can regard as the dataset used to tuning hyperparameters and train model. Visulaization.mis not my target. Cannot make sure it would be gonna work.Change_DataPath.mto automatically change the scriptDataPath.min\internal\.params.HISTOGRAM.STARTING_UVis one hyperparameter that the inital code skip to tune. When load New Dataset, it is possible to warn.Change_PrecomputeTrainingData('Tune')means to correct this value to ignore the warning as much as possible.
Change_PrecomputeTrainingData('Test')means to comment out the code related to this.- in
.\projects\,DefaultConstants.mandDefaultHyperparams.mis to initialization for the first time to tune hyperparameters for new Dataset. - demo dataset in
\data\isdata_NUS_Canon1DsMkIII, the structure of data fold follows the inital version.
-
in
/internal/DataPath.m, two variablespaths.gehler_shiandpaths.chengshould be corrected based on your env. -
When you set
project_nameinTrain.m,Visualization.m, andVisualization.mas Folder Names in\projects, likeproject_name='GehlerShi', no need to generate data followed by Preparation and Folder Structure because training data are directly linked to/data/cheng/preprocessedor/data/shi_gehler/preprocessed.
You can setproject_nameas 'ChengCanon1DsMkIII',ChengCanon600D, etc, butproject_name = 'Cheng'fails because one.mnecessary file misses. -
In
PrivateConstants.m, fromLine 20toLine 28need to change if your plantform is Windows. I slightly change them in order to make them run smoothly on both systems.
if ~ispc()
params.TRAINING.OUTPUT_MODEL_FOLDER = 'models/';
else
params.TRAINING.OUTPUT_MODEL_FOLDER = 'models\';
end
warning off all
if ~ispc()
system(['mkdir ', params.TRAINING.OUTPUT_MODEL_FOLDER, ' &> /dev/null']);
else
system(['mkdir ', params.TRAINING.OUTPUT_MODEL_FOLDER, ' > nul 2>&1']);
end
warning on all;
if ~ispc()
params.TRAINING.OUTPUT_VISUALIZATION_ROOT = 'vis/';
else
params.TRAINING.OUTPUT_VISUALIZATION_ROOT = 'vis\';
end
warning off all
if ~ispc()
system(['mkdir ', params.TRAINING.OUTPUT_VISUALIZATION_ROOT, ' &> /dev/null']);
else
system(['mkdir ', params.TRAINING.OUTPUT_VISUALIZATION_ROOT, ' > nul 2>&1']);
end
warning on all;
- in
PrecomputerTraining.min./internal,line 34should be corrected based on platforms, otherwise it fails to find the training folder on Windows.
if ~ispc()
print_name = folder(1+find(folder(1:end-1) == '/', 1, 'last'):end);
else
print_name = folder(1+find(folder(1:end-1) == '\', 1, 'last'):end);
end
-
in
ScrapeFolder.min./internal, In terms ofLine 52, it fails to work well for MATLAB Win ver. it cannot seperate subfolders well. it should be modified for Windows platforms well.% [subfolder, subfolder_string] = strtok(subfolder_string, ':'); [subfolder, subfolder_string] = strtok(subfolder_string, ';'); -
in
ChengSonyA57Constants.min./projects/. the variableparams.TRAINING.CROSSVALIDATION_DATA_FOLDERshould be modified.Line 23andLine 24, the absolute path fails to work when you setproject_name='ChengAS57'.paths = DataPaths; params.TRAINING.CROSSVALIDATION_DATA_FOLDER ... = fullfile(paths.cheng, 'preprocessed/Cheng/SonyA57/');similarly, in
ChengSonyA57ThumbConstants.min./projects/, the variable should be modified especially when you wanna train ChengSongyA57 Thumb DataSet. -
If you set
project_name = Cheng,Train.m,Tune.mandVisualize.mdoes not work because there is noChengHyperparams.m. You need to Tune to get the ooptimal hyperparameters for the whole Cheng Dataset (cross-camera). But there is noDefaultConstants.mlikeDefaultHyperparams.min the initial version it means that if you use other dataset, it would abort. Don't worry, I set one for the first time to tune hyperparameters for new dataset.