├── .gitignore ├── Pansharpening_Hyper_SR_Matlab_Test_Package ├── .Avg_RR_Assessment.tex.swp ├── AWLP │ └── AWLP.m ├── Avg_RR_Assessment.tex ├── BDSD │ ├── BDSD.m │ ├── BDSD_PC.m │ └── C_BDSD.m ├── BT-H │ └── BroveyRegHazeMin.m ├── Demo1_Reduced_Resolution_WV3_MultiExm.m ├── Demo2_Full_Resolution_WV3_multi.m ├── FE-HPM │ ├── FE.m │ └── FE_HPM.m ├── FR_Assessment.tex ├── GLP │ ├── GS2_GLP.m │ ├── MTF_GLP.m │ ├── MTF_GLP_FS.m │ ├── MTF_GLP_HPM.m │ ├── MTF_GLP_HPM_Haze_min.m │ └── MTF_GLP_HPM_R.m ├── GS │ ├── GS.m │ ├── GSA.m │ └── GS_Segm.m ├── MF │ ├── MF_HG_Pansharpen.m │ └── Pyr_Dec.m ├── PNN │ ├── PNN.m │ ├── PNNplus.m │ ├── fine_tune.m │ ├── ft_learning_rate.m │ ├── input_preparation.m │ ├── input_preparation_.m │ ├── load_layers.m │ ├── maeRegressionLayer.m │ ├── model_scope.m │ └── resize_images_GNyq.m ├── PRACS │ └── PRACS.m ├── PWMBF │ ├── PWMBF.m │ ├── compute_PhiTX.m │ ├── compute_PhiX.m │ └── rwt │ │ ├── .gitignore │ │ ├── AUTHORS │ │ ├── HACKING │ │ ├── INSTALL │ │ ├── LICENSE │ │ ├── README │ │ ├── bin │ │ ├── HardTh.m │ │ ├── SoftTh.m │ │ ├── compile.m │ │ ├── daubcqf.m │ │ ├── denoise.m │ │ ├── makesig.m │ │ ├── mdwt.m │ │ ├── midwt.m │ │ ├── mirdwt.m │ │ ├── mrdwt.m │ │ └── setopt.m │ │ ├── dist │ │ ├── 2.01 │ │ │ ├── INSTALL │ │ │ ├── README │ │ │ ├── RWT-2.01.tar.Z │ │ │ └── doc │ │ │ │ └── index.html │ │ └── 2.3 │ │ │ ├── INSTALL │ │ │ ├── INSTALL_PRECOMPILED │ │ │ ├── LICENSE │ │ │ └── README │ │ ├── doc │ │ └── Doxyfile.in │ │ ├── lib │ │ ├── inc │ │ │ ├── rwt_init.h │ │ │ ├── rwt_platform.h │ │ │ └── rwt_transforms.h │ │ └── src │ │ │ ├── dwt.c │ │ │ ├── idwt.c │ │ │ ├── init.c │ │ │ ├── irdwt.c │ │ │ ├── platform.c │ │ │ └── rdwt.c │ │ ├── mex │ │ ├── mdwt.c │ │ ├── midwt.c │ │ ├── mirdwt.c │ │ └── mrdwt.c │ │ ├── python │ │ ├── LICENSE.numpy │ │ ├── numpy.i │ │ ├── rwt.i │ │ └── test_rwt.py │ │ └── tests │ │ ├── matlab_xunit │ │ ├── Readme.html │ │ ├── architecture │ │ │ ├── class_diagram_a.vsd │ │ │ ├── class_diagram_b.vsd │ │ │ ├── class_diagram_c.vsd │ │ │ ├── html │ │ │ │ ├── class_diagram_a.gif │ │ │ │ ├── class_diagram_b.gif │ │ │ │ ├── class_diagram_c.gif │ │ │ │ └── matlab_xunit_architecture.html │ │ │ ├── matlab_xunit_architecture.m │ │ │ └── testSample.m │ │ ├── doc │ │ │ ├── +abc │ │ │ │ └── +tests │ │ │ │ │ ├── test_that.m │ │ │ │ │ └── test_this.m │ │ │ ├── +abc_tests │ │ │ │ ├── test_that.m │ │ │ │ └── test_this.m │ │ │ ├── exException.m │ │ │ ├── exQuickStart.m │ │ │ ├── exRunSpecificTest.m │ │ │ ├── exRunTestsInADirectory.m │ │ │ ├── exRunTestsInPackage.m │ │ │ ├── exSilentRunning.m │ │ │ ├── exSubfunctionTests.m │ │ │ ├── exTestCase.m │ │ │ ├── exTestCaseSearching.m │ │ │ ├── exTestFixtures.m │ │ │ ├── exTolerance.m │ │ │ ├── example_quick_start │ │ │ │ ├── testFliplrMatrix.m │ │ │ │ └── testFliplrVector.m │ │ │ ├── example_subfunction_tests │ │ │ │ └── testFliplr.m │ │ │ ├── examples_general │ │ │ │ ├── TestUsingTestCase.m │ │ │ │ ├── testBadSinTest.m │ │ │ │ ├── testCos.m │ │ │ │ ├── testSetupExample.m │ │ │ │ ├── testSin.m │ │ │ │ └── testWithSetupError.m │ │ │ ├── helptoc.xml │ │ │ ├── html │ │ │ │ ├── exException.html │ │ │ │ ├── exQuickStart.html │ │ │ │ ├── exRunSpecificTest.html │ │ │ │ ├── exRunTestsInADirectory.html │ │ │ │ ├── exRunTestsInPackage.html │ │ │ │ ├── exSilentRunning.html │ │ │ │ ├── exSubfunctionTests.html │ │ │ │ ├── exTestCase.html │ │ │ │ ├── exTestCaseSearching.html │ │ │ │ ├── exTestFixtures.html │ │ │ │ └── exTolerance.html │ │ │ ├── index.html │ │ │ ├── release-history.html │ │ │ └── xunit_product_page.html │ │ ├── obsolete │ │ │ ├── +mtest │ │ │ │ └── +utils │ │ │ │ │ ├── Contents.m │ │ │ │ │ ├── compareFloats.m │ │ │ │ │ ├── containsRegexp.m │ │ │ │ │ ├── generateDoc.m │ │ │ │ │ ├── isAlmostEqual.m │ │ │ │ │ ├── isSetUpString.m │ │ │ │ │ ├── isTearDownString.m │ │ │ │ │ ├── isTestCaseSubclass.m │ │ │ │ │ ├── isTestString.m │ │ │ │ │ └── parseFloatAssertInputs.m │ │ │ ├── assertAlmostEqual.m │ │ │ ├── mtest.m │ │ │ └── tests │ │ │ │ ├── MtestTest.m │ │ │ │ ├── cwd_test │ │ │ │ ├── TestCaseSubclass.m │ │ │ │ ├── testFoobar.m │ │ │ │ └── testSubfunctions.m │ │ │ │ ├── testAssertAlmostEqual.m │ │ │ │ └── testIsAlmostEqual.m │ │ ├── tests │ │ │ ├── +xunit │ │ │ │ └── +mocktests │ │ │ │ │ ├── +subpkg │ │ │ │ │ └── test_a_bit.m │ │ │ │ │ ├── A.m │ │ │ │ │ ├── B.m │ │ │ │ │ ├── FooTest.m │ │ │ │ │ ├── helper_that.m │ │ │ │ │ ├── test_that.m │ │ │ │ │ └── test_this.m │ │ │ ├── Readme.m │ │ │ ├── RuntestsTest.m │ │ │ ├── TestCaseTest.m │ │ │ ├── TestCaseWithAddPathTest.m │ │ │ ├── TestFuncHandleTests.m │ │ │ ├── TestRunLoggerTest.m │ │ │ ├── TestSuiteTest.m │ │ │ ├── ThrowsExceptionTest.m │ │ │ ├── almost_black.tif │ │ │ ├── black.tif │ │ │ ├── cwd_test │ │ │ │ ├── TestCaseSubclass.m │ │ │ │ ├── testFoobar.m │ │ │ │ └── testSubfunctions.m │ │ │ ├── dir1 │ │ │ │ └── test_thatPasses.m │ │ │ ├── dir2 │ │ │ │ └── test_thatFails.m │ │ │ ├── empty_file │ │ │ ├── helper_classes │ │ │ │ ├── BadFixture.m │ │ │ │ ├── Contents.m │ │ │ │ ├── ExceptionNotThrownTest.m │ │ │ │ ├── FailingTestCase.m │ │ │ │ ├── LoggingTestCase.m │ │ │ │ ├── NoTestMethods.m │ │ │ │ ├── PassingExceptionTest.m │ │ │ │ ├── TestsToBeDiscovered.m │ │ │ │ ├── TwoPassingTests.m │ │ │ │ ├── WrongExceptionThrownTest.m │ │ │ │ ├── notTestString.m │ │ │ │ ├── testFunctionHandlesA.m │ │ │ │ ├── testFunctionHandlesB.m │ │ │ │ ├── testFunctionHandlesC.m │ │ │ │ ├── testFunctionHandlesD.m │ │ │ │ ├── testFunctionHandlesE.m │ │ │ │ ├── testFunctionHandlesTeardownNoSetup.m │ │ │ │ └── testSimple.m │ │ │ ├── testAssertEqual.m │ │ │ ├── testAssertExceptionThrown.m │ │ │ ├── testAssertFalse.m │ │ │ ├── testAssertTrue.m │ │ │ ├── testContainsRegexp.m │ │ │ ├── testIsSetUpString.m │ │ │ ├── testIsTearDownString.m │ │ │ ├── testIsTestCaseSubclass.m │ │ │ ├── testIsTestString.m │ │ │ ├── testRuntestsWithDirectoryName.m │ │ │ ├── test_TestSuiteInDir.m │ │ │ ├── test_arrayToString.m │ │ │ ├── test_assertElementsAlmostEqual.m │ │ │ ├── test_assertFilesEqual.m │ │ │ ├── test_assertVectorsAlmostEqual.m │ │ │ ├── test_compareFloats.m │ │ │ ├── test_comparisonMessage.m │ │ │ ├── test_packageName.m │ │ │ ├── test_parseFloatAssertInputs.m │ │ │ └── test_stringToCellArray.m │ │ └── xunit │ │ │ ├── +xunit │ │ │ └── +utils │ │ │ │ ├── Contents.m │ │ │ │ ├── arrayToString.m │ │ │ │ ├── compareFloats.m │ │ │ │ ├── comparisonMessage.m │ │ │ │ ├── containsRegexp.m │ │ │ │ ├── generateDoc.m │ │ │ │ ├── isAlmostEqual.m │ │ │ │ ├── isSetUpString.m │ │ │ │ ├── isTearDownString.m │ │ │ │ ├── isTestCaseSubclass.m │ │ │ │ ├── isTestString.m │ │ │ │ ├── parseFloatAssertInputs.m │ │ │ │ └── stringToCellArray.m │ │ │ ├── CommandWindowTestRunDisplay.m │ │ │ ├── Contents.m │ │ │ ├── FunctionHandleTestCase.m │ │ │ ├── TestCase.m │ │ │ ├── TestCaseInDir.m │ │ │ ├── TestCaseWithAddPath.m │ │ │ ├── TestComponent.m │ │ │ ├── TestComponentInDir.m │ │ │ ├── TestRunDisplay.m │ │ │ ├── TestRunLogger.m │ │ │ ├── TestRunMonitor.m │ │ │ ├── TestSuite.m │ │ │ ├── TestSuiteInDir.m │ │ │ ├── VerboseTestRunDisplay.m │ │ │ ├── assertElementsAlmostEqual.m │ │ │ ├── assertEqual.m │ │ │ ├── assertExceptionThrown.m │ │ │ ├── assertFalse.m │ │ │ ├── assertFilesEqual.m │ │ │ ├── assertTrue.m │ │ │ ├── assertVectorsAlmostEqual.m │ │ │ ├── info.xml │ │ │ ├── initTestSuite.m │ │ │ └── runtests.m │ │ ├── octave │ │ ├── assertEqual.m │ │ ├── assertVectorsAlmostEqual.m │ │ ├── runtests.m │ │ ├── test_denoise.m │ │ ├── test_makesig.m │ │ ├── test_mdwt.m │ │ ├── test_midwt.m │ │ ├── test_mirdwt.m │ │ ├── test_mrdwt.m │ │ └── test_setopt.m │ │ ├── runtests.m │ │ ├── test_daubcqf.m │ │ ├── test_denoise.m │ │ ├── test_makesig.m │ │ ├── test_mdwt.m │ │ ├── test_midwt.m │ │ ├── test_mirdwt.m │ │ ├── test_mrdwt.m │ │ └── test_setopt.m ├── Quality_Indices │ ├── D_lambda.m │ ├── D_lambda_K.m │ ├── D_s.m │ ├── ERGAS.m │ ├── HQNR.m │ ├── Q.m │ ├── QNR.m │ ├── SAM.m │ ├── SCC.m │ ├── img_qi.m │ ├── mse.m │ ├── norm_blocco.m │ ├── onion_mult.m │ ├── onion_mult2D.m │ ├── onions_quality.m │ ├── psnr_index.m │ ├── q2n.m │ └── ssim.m ├── RR │ ├── RRpansharp.m │ └── manopt │ │ ├── checkinstall │ │ └── basicexample.m │ │ ├── examples │ │ ├── PCA_stochastic.m │ │ ├── dominant_invariant_subspace.m │ │ ├── dominant_invariant_subspace_complex.m │ │ ├── elliptope_SDP.m │ │ ├── elliptope_SDP_complex.m │ │ ├── essential_svd.m │ │ ├── generalized_eigenvalue_computation.m │ │ ├── generalized_procrustes.m │ │ ├── low_rank_dist_completion.m │ │ ├── low_rank_matrix_completion.m │ │ ├── low_rank_tensor_completion.m │ │ ├── maxcut.m │ │ ├── nonlinear_eigenspace.m │ │ ├── packing_on_the_sphere.m │ │ ├── positive_definite_karcher_mean.m │ │ ├── radio_interferometric_calibration.m │ │ ├── robust_pca.m │ │ ├── shapefit_smoothed.m │ │ ├── sparse_pca.m │ │ ├── thomson_problem.m │ │ └── truncated_svd.m │ │ ├── importmanopt.m │ │ ├── manopt │ │ ├── core │ │ │ ├── StoreDB.m │ │ │ ├── applyStatsfun.m │ │ │ ├── canGetApproxGradient.m │ │ │ ├── canGetApproxHessian.m │ │ │ ├── canGetCost.m │ │ │ ├── canGetDirectionalDerivative.m │ │ │ ├── canGetEuclideanGradient.m │ │ │ ├── canGetGradient.m │ │ │ ├── canGetHessian.m │ │ │ ├── canGetLinesearch.m │ │ │ ├── canGetPartialEuclideanGradient.m │ │ │ ├── canGetPartialGradient.m │ │ │ ├── canGetPrecon.m │ │ │ ├── canGetSqrtPrecon.m │ │ │ ├── canGetSubgradient.m │ │ │ ├── getApproxGradient.m │ │ │ ├── getApproxHessian.m │ │ │ ├── getCost.m │ │ │ ├── getCostGrad.m │ │ │ ├── getDirectionalDerivative.m │ │ │ ├── getEuclideanGradient.m │ │ │ ├── getGlobalDefaults.m │ │ │ ├── getGradient.m │ │ │ ├── getGradientFD.m │ │ │ ├── getHessian.m │ │ │ ├── getHessianFD.m │ │ │ ├── getLinesearch.m │ │ │ ├── getPartialEuclideanGradient.m │ │ │ ├── getPartialGradient.m │ │ │ ├── getPrecon.m │ │ │ ├── getSqrtPrecon.m │ │ │ ├── getStore.m │ │ │ ├── getSubgradient.m │ │ │ ├── handle_light.m │ │ │ ├── mergeOptions.m │ │ │ ├── purgeStoredb.m │ │ │ ├── setStore.m │ │ │ └── stoppingcriterion.m │ │ ├── manifolds │ │ │ ├── complexcircle │ │ │ │ ├── complexcirclefactory.m │ │ │ │ └── realphasefactory.m │ │ │ ├── essential │ │ │ │ ├── essential_costE2cost.m │ │ │ │ ├── essential_egradE2egrad.m │ │ │ │ ├── essential_ehessE2ehess.m │ │ │ │ ├── essential_flat.m │ │ │ │ ├── essential_hat3.m │ │ │ │ ├── essential_sharp.m │ │ │ │ ├── essentialfactory.m │ │ │ │ └── privateessential │ │ │ │ │ ├── essential_closestRepresentative.m │ │ │ │ │ ├── essential_distMinAngle.m │ │ │ │ │ ├── essential_distMinAnglePair.m │ │ │ │ │ ├── essential_distMinAnglePair_base.m │ │ │ │ │ ├── essential_distMinAnglePair_computeDfBreak.m │ │ │ │ │ ├── essential_distMinAnglePair_dfNewton.m │ │ │ │ │ ├── essential_distMinAnglePair_discontinuityDistance.m │ │ │ │ │ ├── essential_distMinAnglePair_ft.m │ │ │ │ │ ├── essential_distMinAnglePair_ftFromQ.m │ │ │ │ │ ├── essential_distMinAnglePair_test.m │ │ │ │ │ └── modAngle.m │ │ │ ├── euclidean │ │ │ │ ├── centeredmatrixfactory.m │ │ │ │ ├── euclideancomplexfactory.m │ │ │ │ ├── euclideanfactory.m │ │ │ │ ├── shapefitfactory.m │ │ │ │ ├── skewsymmetricfactory.m │ │ │ │ └── symmetricfactory.m │ │ │ ├── fixedrank │ │ │ │ ├── fixedrankMNquotientfactory.m │ │ │ │ ├── fixedrankembeddedfactory.m │ │ │ │ ├── fixedrankfactory_2factors.m │ │ │ │ ├── fixedrankfactory_2factors_preconditioned.m │ │ │ │ ├── fixedrankfactory_2factors_subspace_projection.m │ │ │ │ ├── fixedrankfactory_3factors.m │ │ │ │ └── fixedrankfactory_3factors_preconditioned.m │ │ │ ├── fixedranktensors │ │ │ │ ├── fixedrankfactory_tucker_preconditioned.m │ │ │ │ └── tucker2multiarray.m │ │ │ ├── grassmann │ │ │ │ ├── grassmanncomplexfactory.m │ │ │ │ ├── grassmannfactory.m │ │ │ │ └── grassmanngeneralizedfactory.m │ │ │ ├── multinomial │ │ │ │ └── multinomialfactory.m │ │ │ ├── oblique │ │ │ │ ├── obliquecomplexfactory.m │ │ │ │ └── obliquefactory.m │ │ │ ├── rotations │ │ │ │ ├── randrot.m │ │ │ │ ├── randskew.m │ │ │ │ └── rotationsfactory.m │ │ │ ├── specialeuclidean │ │ │ │ └── specialeuclideanfactory.m │ │ │ ├── sphere │ │ │ │ ├── spherecomplexfactory.m │ │ │ │ ├── spherefactory.m │ │ │ │ └── spheresymmetricfactory.m │ │ │ ├── stiefel │ │ │ │ ├── stiefelcomplexfactory.m │ │ │ │ ├── stiefelfactory.m │ │ │ │ ├── stiefelgeneralizedfactory.m │ │ │ │ └── stiefelstackedfactory.m │ │ │ └── symfixedrank │ │ │ │ ├── elliptopefactory.m │ │ │ │ ├── spectrahedronfactory.m │ │ │ │ ├── symfixedrankYYcomplexfactory.m │ │ │ │ ├── symfixedrankYYfactory.m │ │ │ │ └── sympositivedefinitefactory.m │ │ ├── solvers │ │ │ ├── barzilaiborwein │ │ │ │ └── barzilaiborwein.m │ │ │ ├── bfgs │ │ │ │ └── rlbfgs.m │ │ │ ├── conjugategradient │ │ │ │ ├── conjugategradient.m │ │ │ │ └── linear_conjugategradient.m │ │ │ ├── gradientapproximations │ │ │ │ └── approxgradientFD.m │ │ │ ├── hessianapproximations │ │ │ │ └── approxhessianFD.m │ │ │ ├── linesearch │ │ │ │ ├── linesearch.m │ │ │ │ ├── linesearch_adaptive.m │ │ │ │ ├── linesearch_decrease.m │ │ │ │ └── linesearch_hint.m │ │ │ ├── neldermead │ │ │ │ ├── centroid.m │ │ │ │ └── neldermead.m │ │ │ ├── preconditioners │ │ │ │ └── preconhessiansolve.m │ │ │ ├── pso │ │ │ │ └── pso.m │ │ │ ├── steepestdescent │ │ │ │ └── steepestdescent.m │ │ │ ├── stochasticgradient │ │ │ │ ├── stepsize_sg.m │ │ │ │ └── stochasticgradient.m │ │ │ └── trustregions │ │ │ │ ├── tCG.m │ │ │ │ └── trustregions.m │ │ └── tools │ │ │ ├── checkdiff.m │ │ │ ├── checkgradient.m │ │ │ ├── checkhessian.m │ │ │ ├── checkretraction.m │ │ │ ├── criticalpointfinder.m │ │ │ ├── dexpm.m │ │ │ ├── dfunm.m │ │ │ ├── diagsum.m │ │ │ ├── dlogm.m │ │ │ ├── dsqrtm.m │ │ │ ├── grammatrix.m │ │ │ ├── hashmd5.m │ │ │ ├── hessianextreme.m │ │ │ ├── hessianmatrix.m │ │ │ ├── hessianspectrum.m │ │ │ ├── identify_linear_piece.m │ │ │ ├── lincomb.m │ │ │ ├── manoptsolve.m │ │ │ ├── matrixlincomb.m │ │ │ ├── multihconj.m │ │ │ ├── multiherm.m │ │ │ ├── multiprod.m │ │ │ ├── multiscale.m │ │ │ ├── multiskew.m │ │ │ ├── multisqnorm.m │ │ │ ├── multisym.m │ │ │ ├── multitrace.m │ │ │ ├── multitransp.m │ │ │ ├── orthogonalize.m │ │ │ ├── plotprofile.m │ │ │ ├── powermanifold.m │ │ │ ├── productmanifold.m │ │ │ ├── smallestinconvexhull.m │ │ │ ├── statsfunhelper.m │ │ │ ├── surfprofile.m │ │ │ ├── tangent2vec.m │ │ │ ├── tangentorthobasis.m │ │ │ ├── tangentspacefactory.m │ │ │ └── tangentspherefactory.m │ │ └── manopt_version.m ├── SR-D │ ├── CS.m │ ├── Dict_Learn.m │ ├── OMP.m │ └── OMP_Rec_Detile.m ├── TV │ └── TV_pansharpen.m ├── Tools │ ├── LPfilter.m │ ├── LPfilterGauss.m │ ├── LPfilterPlusDec.m │ ├── MTF.m │ ├── MTF_PAN.m │ ├── estimation_alpha.m │ ├── genMTF.m │ ├── gen_LP_image.m │ ├── indexes_evaluation.m │ ├── indexes_evaluation_FS.m │ ├── indwt2_working.m │ ├── interp23tap.m │ ├── k_means_clustering.m │ ├── matrix2latex.m │ ├── ndwt2_working.m │ ├── printImage.m │ ├── rectangleonimage.m │ ├── resize_images.m │ ├── showImage4.m │ ├── showImage4LR.m │ ├── showImage4LR_zoomin.m │ ├── showImage4_zoomin.m │ ├── showImage8.m │ ├── showImage8LR.m │ ├── showImage8LR_zoomin.m │ ├── showImage8_zoomin.asv │ ├── showImage8_zoomin.m │ ├── showImagesAll.m │ ├── showImagesAllOld.m │ ├── showPan.m │ ├── showPan_zoomin.m │ ├── tight_subplot.m │ ├── viewimage.m │ └── viewimage2.m ├── analysis_ref_batched_images.m ├── analysis_ref_unbatched_images.m ├── analysis_unref_batched_images.asv ├── analysis_unref_batched_images.m ├── analysis_unref_unbatched_images.m ├── nohup.out ├── printAllImagesImWriteFR.m ├── printAllImagesImWriteRR.m ├── quality_assess.m ├── rantest.m ├── read_h5_data.m └── ssim_index.m ├── README.md ├── accelerate_run_VIS_IR_engine.py ├── accelerate_run_hyper_ms_engine.py ├── accelerate_run_main.py ├── configs ├── FeINFN_config.yaml ├── LEMamba_config.yaml ├── MGDN_config.yaml ├── MIMO_SST_config.yaml ├── cssnet_config.yaml ├── dcfnet_config.yaml ├── dct_config.yaml ├── fuseformer_config.yaml ├── fusionnet_config.yaml ├── gppnn_config.yaml ├── gppnn_cvpr_config.yaml ├── hpmnet_config.yaml ├── hsrnet_config.yaml ├── huggingface │ ├── accelerate.yaml │ ├── accelerate_fsdp_config.yaml │ ├── deepspeed_ZERO1_config.json │ ├── deepspeed_ZERO2_bf16_config.json │ ├── deepspeed_ZERO2_config.json │ ├── deepspeed_ZERO2_offload_config.json │ ├── deepspeed_ZERO3_config.json │ └── deepspeed_ZERO3_offload_config.json ├── hyper_transformer_config.yaml ├── hypertransformer_config.yaml ├── hypertransformer_pre_config.yaml ├── lformer_config.yaml ├── m3dnet_config.yaml ├── mmnet_config.yaml ├── panformer_config.yaml ├── panmamba_eccv_config.yaml ├── pannet_config.yaml ├── pmacnet_config.yaml ├── pscfnet_config.yaml ├── restfnet_config.yaml ├── ssrnet_config.yaml └── ydtr_config.yaml ├── model ├── 3DT-Net.py ├── CSSNet.py ├── DCFNet.py ├── DHIF.py ├── DSPNet.py ├── FeINFN.py ├── FusionNet.py ├── GPPNN.py ├── HPMNet.py ├── LAGConv.py ├── LEMamba.py ├── LFormer.py ├── LGTEUN.py ├── M3DNet.py ├── MGDN.py ├── MIMO_SST.py ├── MoGDCN.py ├── PANNet.py ├── PSCFNet.py ├── PanMamba_ECCV.py ├── ResTFNet.py ├── SSRNet.py ├── YDTR.py ├── __init__.py ├── _cssnet_function.py ├── base_model.py ├── build_network.py ├── fuseformer.py ├── gppnn_cvpr.py ├── hsrnet.py ├── hypertransformer.py ├── mamba_scan │ ├── README.md │ ├── csrc │ │ └── selective_scan │ │ │ ├── cus │ │ │ ├── selective_scan.cpp │ │ │ ├── selective_scan_bwd_kernel.cuh │ │ │ ├── selective_scan_core_bwd.cu │ │ │ ├── selective_scan_core_fwd.cu │ │ │ └── selective_scan_fwd_kernel.cuh │ │ │ ├── cusndstate │ │ │ ├── selective_scan_bwd_kernel_ndstate.cuh │ │ │ ├── selective_scan_core_bwd.cu │ │ │ ├── selective_scan_core_fwd.cu │ │ │ ├── selective_scan_fwd_kernel_ndstate.cuh │ │ │ ├── selective_scan_ndstate.cpp │ │ │ └── selective_scan_ndstate.h │ │ │ ├── cusnrow │ │ │ ├── selective_scan_bwd_kernel_nrow.cuh │ │ │ ├── selective_scan_core_bwd.cu │ │ │ ├── selective_scan_core_bwd2.cu │ │ │ ├── selective_scan_core_bwd3.cu │ │ │ ├── selective_scan_core_bwd4.cu │ │ │ ├── selective_scan_core_fwd.cu │ │ │ ├── selective_scan_core_fwd2.cu │ │ │ ├── selective_scan_core_fwd3.cu │ │ │ ├── selective_scan_core_fwd4.cu │ │ │ ├── selective_scan_fwd_kernel_nrow.cuh │ │ │ └── selective_scan_nrow.cpp │ │ │ ├── cusoflex │ │ │ ├── selective_scan_bwd_kernel_oflex.cuh │ │ │ ├── selective_scan_core_bwd.cu │ │ │ ├── selective_scan_core_fwd.cu │ │ │ ├── selective_scan_fwd_kernel_oflex.cuh │ │ │ └── selective_scan_oflex.cpp │ │ │ ├── reverse_scan.cuh │ │ │ ├── selective_scan.h │ │ │ ├── selective_scan_common.h │ │ │ ├── static_switch.h │ │ │ └── uninitialized_copy.cuh │ ├── selective_scan.egg-info │ │ └── PKG-INFO │ ├── setup.py │ ├── test_selective_scan.py │ ├── test_selective_scan_easy.py │ └── test_selective_scan_speed.py ├── mmnet.py ├── module │ ├── M3D_attention.py │ ├── __init__.py │ ├── attention.py │ ├── csm_triton.py │ ├── fe_block.py │ ├── helper_func.py │ ├── inv_block.py │ ├── layer_norm.py │ ├── linformer_attn.py │ ├── mamba_scan │ │ ├── README.md │ │ ├── csrc │ │ │ └── selective_scan │ │ │ │ ├── cus │ │ │ │ ├── selective_scan.cpp │ │ │ │ ├── selective_scan_bwd_kernel.cuh │ │ │ │ ├── selective_scan_core_bwd.cu │ │ │ │ ├── selective_scan_core_fwd.cu │ │ │ │ └── selective_scan_fwd_kernel.cuh │ │ │ │ ├── cusndstate │ │ │ │ ├── selective_scan_bwd_kernel_ndstate.cuh │ │ │ │ ├── selective_scan_core_bwd.cu │ │ │ │ ├── selective_scan_core_fwd.cu │ │ │ │ ├── selective_scan_fwd_kernel_ndstate.cuh │ │ │ │ ├── selective_scan_ndstate.cpp │ │ │ │ └── selective_scan_ndstate.h │ │ │ │ ├── cusnrow │ │ │ │ ├── selective_scan_bwd_kernel_nrow.cuh │ │ │ │ ├── selective_scan_core_bwd.cu │ │ │ │ ├── selective_scan_core_bwd2.cu │ │ │ │ ├── selective_scan_core_bwd3.cu │ │ │ │ ├── selective_scan_core_bwd4.cu │ │ │ │ ├── selective_scan_core_fwd.cu │ │ │ │ ├── selective_scan_core_fwd2.cu │ │ │ │ ├── selective_scan_core_fwd3.cu │ │ │ │ ├── selective_scan_core_fwd4.cu │ │ │ │ ├── selective_scan_fwd_kernel_nrow.cuh │ │ │ │ └── selective_scan_nrow.cpp │ │ │ │ ├── cusoflex │ │ │ │ ├── selective_scan_bwd_kernel_oflex.cuh │ │ │ │ ├── selective_scan_core_bwd.cu │ │ │ │ ├── selective_scan_core_fwd.cu │ │ │ │ ├── selective_scan_fwd_kernel_oflex.cuh │ │ │ │ └── selective_scan_oflex.cpp │ │ │ │ ├── reverse_scan.cuh │ │ │ │ ├── selective_scan.h │ │ │ │ ├── selective_scan_common.h │ │ │ │ ├── static_switch.h │ │ │ │ └── uninitialized_copy.cuh │ │ ├── selective_scan.egg-info │ │ │ └── PKG-INFO │ │ ├── setup.py │ │ ├── test_selective_scan.py │ │ ├── test_selective_scan_easy.py │ │ └── test_selective_scan_speed.py │ ├── mlp.py │ ├── mobile_vit_v2_attn.py │ ├── nonlocal_block.py │ ├── patch_merge_module │ │ ├── import_module.py │ │ ├── py310_module │ │ │ └── PatchMergeModule.cpython-310-x86_64-linux-gnu.so │ │ ├── py312_module │ │ │ └── PatchMergeModule.cpython-312-x86_64-linux-gnu.so │ │ ├── py37_module │ │ │ └── PatchMergeModule.cpython-37m-x86_64-linux-gnu.so │ │ ├── py38_module │ │ │ └── PatchMergeModule.cpython-38-x86_64-linux-gnu.so │ │ └── py39_module │ │ │ └── PatchMergeModule.cpython-39-x86_64-linux-gnu.so │ ├── performer_attn.py │ ├── refine.py │ ├── resblock.py │ ├── stem.py │ ├── swin.py │ ├── thops.py │ ├── tome.py │ ├── vim_module_used_in_panmamba_zhouman │ │ ├── Vim │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── assets │ │ │ │ ├── vim_pipeline_v1.9.png │ │ │ │ └── vim_teaser_v1.7.png │ │ │ ├── causal-conv1d │ │ │ │ ├── .cache │ │ │ │ │ └── matplotlib │ │ │ │ │ │ └── fontlist-v330.json │ │ │ │ ├── AUTHORS │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── causal_conv1d-1.0.0+cu118torch2.2cxx11abiFALSE-cp39-cp39-linux_x86_64.whl │ │ │ │ ├── causal_conv1d │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── causal_conv1d_interface.py │ │ │ │ ├── csrc │ │ │ │ │ ├── causal_conv1d.cpp │ │ │ │ │ ├── causal_conv1d.h │ │ │ │ │ ├── causal_conv1d_bwd.cu │ │ │ │ │ ├── causal_conv1d_common.h │ │ │ │ │ ├── causal_conv1d_fwd.cu │ │ │ │ │ ├── causal_conv1d_update.cu │ │ │ │ │ └── static_switch.h │ │ │ │ ├── setup.py │ │ │ │ └── tests │ │ │ │ │ └── test_causal_conv1d.py │ │ │ ├── mamba-1p1p1 │ │ │ │ ├── .cache │ │ │ │ │ └── matplotlib │ │ │ │ │ │ └── fontlist-v330.json │ │ │ │ ├── .github │ │ │ │ │ └── workflows │ │ │ │ │ │ └── publish.yaml │ │ │ │ ├── .gitignore │ │ │ │ ├── .gitmodules │ │ │ │ ├── AUTHORS │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── assets │ │ │ │ │ └── selection.png │ │ │ │ ├── benchmarks │ │ │ │ │ └── benchmark_generation_mamba_simple.py │ │ │ │ ├── csrc │ │ │ │ │ └── selective_scan │ │ │ │ │ │ ├── reverse_scan.cuh │ │ │ │ │ │ ├── selective_scan.cpp │ │ │ │ │ │ ├── selective_scan.h │ │ │ │ │ │ ├── selective_scan_bwd_bf16_complex.cu │ │ │ │ │ │ ├── selective_scan_bwd_bf16_real.cu │ │ │ │ │ │ ├── selective_scan_bwd_fp16_complex.cu │ │ │ │ │ │ ├── selective_scan_bwd_fp16_real.cu │ │ │ │ │ │ ├── selective_scan_bwd_fp32_complex.cu │ │ │ │ │ │ ├── selective_scan_bwd_fp32_real.cu │ │ │ │ │ │ ├── selective_scan_bwd_kernel.cuh │ │ │ │ │ │ ├── selective_scan_common.h │ │ │ │ │ │ ├── selective_scan_fwd_bf16.cu │ │ │ │ │ │ ├── selective_scan_fwd_fp16.cu │ │ │ │ │ │ ├── selective_scan_fwd_fp32.cu │ │ │ │ │ │ ├── selective_scan_fwd_kernel.cuh │ │ │ │ │ │ ├── static_switch.h │ │ │ │ │ │ └── uninitialized_copy.cuh │ │ │ │ ├── evals │ │ │ │ │ └── lm_harness_eval.py │ │ │ │ ├── mamba_ssm │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── models │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── config_mamba.py │ │ │ │ │ │ └── mixer_seq_simple.py │ │ │ │ │ ├── modules │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── mamba_simple.py │ │ │ │ │ │ └── mamba_simple_vim_origin.py │ │ │ │ │ ├── ops │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── selective_scan_interface.py │ │ │ │ │ │ └── triton │ │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ │ ├── layernorm.py │ │ │ │ │ │ │ └── selective_state_update.py │ │ │ │ │ └── utils │ │ │ │ │ │ ├── __init__.py │ │ │ │ │ │ ├── generation.py │ │ │ │ │ │ └── hf.py │ │ │ │ ├── setup.py │ │ │ │ └── tests │ │ │ │ │ └── ops │ │ │ │ │ ├── test_selective_scan.py │ │ │ │ │ └── triton │ │ │ │ │ └── test_selective_state_update.py │ │ │ └── vim │ │ │ │ ├── .gitignore │ │ │ │ ├── LICENSE │ │ │ │ ├── augment.py │ │ │ │ ├── datasets.py │ │ │ │ ├── engine.py │ │ │ │ ├── hubconf.py │ │ │ │ ├── losses.py │ │ │ │ ├── main.py │ │ │ │ ├── models_mamba.py │ │ │ │ ├── rope.py │ │ │ │ ├── run_with_submitit.py │ │ │ │ ├── samplers.py │ │ │ │ ├── scripts │ │ │ │ ├── ft-vim-s.sh │ │ │ │ ├── ft-vim-t.sh │ │ │ │ ├── pt-vim-s.sh │ │ │ │ └── pt-vim-t.sh │ │ │ │ ├── utils.py │ │ │ │ └── vim_requirements.txt │ │ ├── mamba_module.py │ │ └── mamba_simple.py │ └── vmamba_module_v3.py ├── pmacnet.py ├── reciprocal_transformer.py ├── restfnet.py ├── test │ └── LEMamba_test.py ├── u2net.py └── ydtr.py ├── readmes ├── FeINFN.md ├── figs │ ├── le-mamba-HMIF.png │ ├── le-mamba-pansharpening.png │ └── le-mamba-teaser.png ├── le-mamba.md └── lformer.md ├── requirement.txt ├── scripts ├── accelerate_run.sh └── torch_sharpening_run.sh ├── task_datasets ├── GF2.py ├── HISR.py ├── WV3.py ├── __init__.py └── prefetcher.py ├── teasers ├── FeINFN.png ├── fusion-00004N.png ├── ir-00004N.png ├── tesear-seg.png ├── vi-00004N.png ├── yolov5-after-fused.jpg └── yolov5-before-fused.jpg ├── torch_inference_on_sharpening.py ├── torch_run_engine.py ├── torch_run_main.py └── utils ├── FS_index ├── D_lambda_K.py ├── HQNR.py ├── MTF.py ├── MTF_pan.py ├── __init__.py ├── genMTF.py ├── genMTF_pan.py ├── hqnr2.py ├── imresize.py ├── indexes_evaluation_FS.py ├── interp23.py ├── my_D_s.py ├── my_q2n.py └── tools.py ├── __init__.py ├── _metric_legacy.py ├── calculate_metric_from_file.py ├── ema_utils ├── __init__.py ├── ema.py └── post_hoc_ema.py ├── inference_helper_func.py ├── load_params.py ├── log_utils.py ├── loss_landscape ├── .gitignore ├── LICENSE ├── README.md ├── cifar10 │ ├── __init__.py │ ├── dataloader.py │ ├── main.py │ ├── model_loader.py │ └── models │ │ ├── __init__.py │ │ ├── densenet.py │ │ ├── resnet.py │ │ └── vgg.py ├── dataloader.py ├── doc │ └── images │ │ ├── resnet56_noshort_small.jpg │ │ ├── resnet56_sgd_lr=0.1_bs=128_wd=0.0005 │ │ └── model_300.t7_weights_xignore=biasbn_xnorm=filter_yignore=biasbn_ynorm=filter.h5_[-1.0,1.0,51]x[-1.0,1.0,51].h5_train_loss_2dcontour.jpg │ │ ├── resnet56_small.jpg │ │ ├── vgg9_sgd_lr=0.1_bs=128_wd=0.0005_save_epoch=1_model_300.t7_vgg9_sgd_lr=0.1_bs=8192_wd=0.0005_save_epoch=1_model_300.t7_states.h5_[-1.0,1.0,401].h5_1d_loss_acc.jpg │ │ ├── vgg9_sgd_lr=0.1_bs=128_wd=0.0_save_epoch=1 │ │ └── model_300.t7_weights_xignore=biasbn_xnorm=filter.h5_[-1.0,1.0,51].h5_1d_loss_acc.jpg │ │ └── vgg9_sgd_lr=0.1_bs=128_wd=0.0_save_epoch=1_model_300.t7_vgg9_sgd_lr=0.1_bs=8192_wd=0.0_save_epoch=1_model_300.t7_states.h5_[-1.0,1.0,401].h5_1d_loss_acc.jpg ├── evaluation.py ├── h52vtp.py ├── h5_util.py ├── hess_vec_prod.py ├── model_loader.py ├── mpi4pytorch.py ├── net_plotter.py ├── plot_1D.py ├── plot_2D.py ├── plot_hessian_eigen.py ├── plot_surface.py ├── plot_trajectory.py ├── projection.py ├── scheduler.py └── script │ ├── 1d_linear_interpolation_resnet56.sh │ ├── 1d_linear_interpolation_vgg9.sh │ ├── 1d_loss_curve_resnet56.sh │ ├── 1d_loss_curve_vgg9.sh │ ├── 2d_contour_resnet56.sh │ ├── 2d_contour_resnet_noshort.sh │ └── 2d_contour_vgg9.sh ├── loss_utils.py ├── metric.py ├── metric_sharpening.py ├── misc.py ├── model_perf_utils.py ├── network_utils.py ├── optim_utils.py ├── print_helper.py ├── progress_utils.py ├── sailency ├── BackProp.py ├── __init__.py ├── attributes.py └── utils.py ├── save_checker.py ├── save_to_mat.py ├── sharpening_index ├── D_lambda_K.py ├── HQNR.py ├── MTF.py ├── MTF_pan.py ├── __init__.py ├── genMTF.py ├── genMTF_pan.py ├── hqnr2.py ├── imresize.py ├── indexes_evaluation_FS.py ├── interp23.py ├── my_D_s.py ├── my_q2n.py └── tools.py ├── train_utils.py ├── utils_modules ├── __init__.py ├── adam_mini.py └── unet5.py └── visualize.py /Pansharpening_Hyper_SR_Matlab_Test_Package/.Avg_RR_Assessment.tex.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/.Avg_RR_Assessment.tex.swp -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/AWLP/AWLP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/AWLP/AWLP.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/BDSD/BDSD.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/BDSD/BDSD.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/BDSD/BDSD_PC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/BDSD/BDSD_PC.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/BDSD/C_BDSD.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/BDSD/C_BDSD.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/FR_Assessment.tex: -------------------------------------------------------------------------------- 1 | \begin{tabular}{|l|c|c|c|} 2 | \hline 3 | &\textbf{DL}&\textbf{DS}&\textbf{HQNR}\\\hline 4 | \textbf{BT-H}&0.0822&0.0537&0.8686\\\hline 5 | \textbf{BDSD-PC}&0.1042&0.0490&0.8519\\\hline 6 | \textbf{MTF-GLP-HPM-R}&0.0552&0.0323&0.9143\\\hline 7 | \textbf{MTF-GLP-FS}&0.0536&0.0386&0.9098\\\hline 8 | \textbf{TV}&0.0585&0.0248&0.9182\\\hline 9 | \textbf{PNN}&0.0000&0.0000&0.0000\\\hline 10 | \textbf{PanNet}&0.0000&0.0000&0.0000\\\hline 11 | \textbf{DiCNN}&0.0000&0.0000&0.0000\\\hline 12 | \textbf{MSDCNN}&0.0000&0.0000&0.0000\\\hline 13 | \textbf{BDPN}&0.0000&0.0000&0.0000\\\hline 14 | \textbf{FusionNet}&0.0000&0.0000&0.0000\\\hline 15 | \textbf{LAGConv}&0.0000&0.0000&0.0000\\\hline 16 | \end{tabular} 17 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/GLP/GS2_GLP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/GLP/GS2_GLP.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/GLP/MTF_GLP.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/GLP/MTF_GLP.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/GLP/MTF_GLP_HPM.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/GLP/MTF_GLP_HPM.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/GS/GS.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/GS/GS.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/GS/GSA.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/GS/GSA.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/GS/GS_Segm.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/GS/GS_Segm.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/MF/MF_HG_Pansharpen.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/MF/MF_HG_Pansharpen.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/MF/Pyr_Dec.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/MF/Pyr_Dec.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PNN/load_layers.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Description: 3 | % Load pretrained layers from network trained in Python. 4 | % Interface: 5 | % layers = load_layers(firstLayer,model) 6 | % Inputs: 7 | % firstLayer: Input layer with info for input image; 8 | % model: Struct with training details of pretrained network. 9 | % Output: 10 | % layers: List of layers. 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | function layers = load_layers(firstLayer,model) 13 | conv_layer = {}; 14 | k=0; 15 | layers=[firstLayer]; 16 | for i = [1:2:length(model.layers)] 17 | k=k+1; 18 | s = size(model.layers{i}); 19 | conv_layer{k}=convolution2dLayer(s(1),s(4)); 20 | conv_layer{k}.Name = sprintf('conv%d',k); 21 | conv_layer{k}.Weights = model.layers{i}; 22 | conv_layer{k}.Bias = model.layers{i+1}; 23 | if i < length(model.layers)-1 24 | l = reluLayer('Name',sprintf('relu%d',k)); 25 | layers = [layers,conv_layer{k},l]; 26 | else 27 | layers = [layers,conv_layer{k}]; 28 | end 29 | end 30 | 31 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PNN/model_scope.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Description: 3 | % Compute the network scope. 4 | % Interface: 5 | % net_scope = model_scope(model) 6 | % Input: 7 | % model: Struct with training details of pretrained network. 8 | % Output: 9 | % net_scope: Scope of network. 10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 11 | function net_scope = model_scope(model) 12 | net_scope = 0; 13 | for i = 1:2:length(model.layers) 14 | net_scope = net_scope + size(model.layers{i},1)-1; 15 | end 16 | net_scope = double(net_scope+1); 17 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PNN/resize_images_GNyq.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PNN/resize_images_GNyq.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PRACS/PRACS.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PRACS/PRACS.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/.gitignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | */.*.swp 3 | *.mex* 4 | *.c~ 5 | *.h~ 6 | *.m~ 7 | docs/html 8 | docs/latex 9 | CMakeCache.txt 10 | CMakeFiles/ 11 | Makefile 12 | cmake_install.cmake 13 | doc/CMakeFiles/ 14 | doc/Doxyfile 15 | doc/Makefile 16 | doc/cmake_install.cmake 17 | doc/html/ 18 | doc/latex/ 19 | lib/src/CMakeFiles/ 20 | lib/src/Makefile 21 | lib/src/cmake_install.cmake 22 | lib/src/*.a 23 | lib/src/*.o 24 | */*.o 25 | python/_rwt.so 26 | python/rwt.py 27 | python/rwt.pyc 28 | python/rwtPYTHON_wrap.cxx 29 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/AUTHORS: -------------------------------------------------------------------------------- 1 | The primary authors of Rice Wavelet Toolbox are and/or have been: 2 | * Richard Baraniuk 3 | * Hyeokho Choi 4 | * Ramesh Neelamani 5 | * Vinay Ribeiro 6 | * Rebecca Hindman 7 | * Justin Romberg 8 | * Haitao Guo 9 | * Felix Fernandes 10 | * Brent Hendricks 11 | * Ramesh Gopinath 12 | * Markus Lang 13 | * Jan Erik Odegard 14 | * Dong Wei 15 | * Joshua Jackson 16 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/bin/HardTh.m: -------------------------------------------------------------------------------- 1 | function x = HardTh(y,thld) 2 | % x = HardTh(y,thld); 3 | % 4 | % HARDTH hard thresholds the input signal y with the threshold value 5 | % thld. 6 | % 7 | % Input: 8 | % y : 1D or 2D signal to be thresholded 9 | % thld : threshold value 10 | % 11 | % Output: 12 | % x : Hard thresholded output (x = (abs(y)>thld).*y) 13 | % 14 | % HERE'S AN EASY WAY TO RUN THE EXAMPLES: 15 | % Cut-and-paste the example you want to run to a new file 16 | % called ex.m, for example. Delete out the % at the beginning 17 | % of each line in ex.m (Can use search-and-replace in your editor 18 | % to replace it with a space). Type 'ex' in matlab and hit return. 19 | % 20 | % 21 | % Example: 22 | % y = makesig('WernerSorrows',8); 23 | % thld = 1; 24 | % x = HardTh(y,thld) 25 | % x = 1.5545 5.3175 0 1.6956 -1.2678 0 1.7332 0 26 | % 27 | % See also: SoftTh 28 | % 29 | %Author: Haitao Guo 30 | 31 | x = (abs(y) > thld).*y; 32 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/bin/SoftTh.m: -------------------------------------------------------------------------------- 1 | function x = SoftTh(y,thld) 2 | % x = SoftTh(y,thld); 3 | % 4 | % SOFTTH soft thresholds the input signal y with the threshold value 5 | % thld. 6 | % 7 | % Input: 8 | % y : 1D or 2D signal to be thresholded 9 | % thld : Threshold value 10 | % 11 | % Output: 12 | % x : Soft thresholded output (x = sign(y)(|y|-thld)_+) 13 | % 14 | % HERE'S AN EASY WAY TO RUN THE EXAMPLES: 15 | % Cut-and-paste the example you want to run to a new file 16 | % called ex.m, for example. Delete out the % at the beginning 17 | % of each line in ex.m (Can use search-and-replace in your editor 18 | % to replace it with a space). Type 'ex' in matlab and hit return. 19 | % 20 | % 21 | % Example: 22 | % y = makesig('Doppler',8); 23 | % thld = 0.2; 24 | % x = SoftTh(y,thld) 25 | % x = 0 0 0 -0.0703 0 0.2001 0.0483 0 26 | % 27 | % See also: HardTh 28 | % 29 | % Reference: 30 | % "De-noising via Soft-Thresholding" Tech. Rept. Statistics, 31 | % Stanford, 1992. D.L. Donoho. 32 | % 33 | %Author: Haitao Guo 34 | 35 | x = abs(y); 36 | x = sign(y).*(x >= thld).*(x - thld); 37 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/bin/setopt.m: -------------------------------------------------------------------------------- 1 | function option = setopt(opt_par,default); 2 | % option = setopt(opt_par,default); 3 | % 4 | % SETOPT can modify a default option vector with user specified options. 5 | % 6 | % Input: 7 | % opt_par : Users desired option vector 8 | % default : Program default option vector 9 | % 10 | % Output: 11 | % option : New option vector 12 | % 13 | % Example: 14 | % opt_par = [1 2 3 4]; 15 | % default = [1 1 1 1]; 16 | % option = setopt(opt_par,default) 17 | % option = 1 2 3 4 18 | % 19 | %Author: Jan Erik Odegard 20 | 21 | if (nargin < 2) 22 | error('You need two inputs'); 23 | end; 24 | len = length(opt_par); 25 | option = zeros(size(default)); 26 | option(1:len) = opt_par(1:len); 27 | option = option + (option == 0).*default; 28 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/dist/2.01/RWT-2.01.tar.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/dist/2.01/RWT-2.01.tar.Z -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/dist/2.3/INSTALL: -------------------------------------------------------------------------------- 1 | Installation instructions 2 | ------------------------- 3 | 4 | In order to install this distribution of Rice Wavelet Tools version 2.3 5 | released - 6 | 7 | 1. Properly set up your system to create MEX-files. Please refer to the 8 | "Matlab Application Program Guide" to properly set up of your matlab 9 | and C-compiler to be able to compile C-mex files on your system. 10 | All reference documentations are available on the MathWorks web page: 11 | www.mathworks.com 12 | 13 | 2. Make a toolbox directory and uncompress/extract all the files. 14 | For example, in the unix environment, 15 | 16 | gunzip rwt.tar.gz 17 | tar xvf rwt.tar 18 | 19 | 3. Run MATLAB and change to the temporary directory containing the files. 20 | 21 | 4. Compile the toolbox by executing the Matlab command 22 | 23 | compile 24 | 25 | 5. Add the toolbox directory to your Matlab path. 26 | 27 | 6. For further instructions, please refer to the README file. 28 | 29 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/dist/2.3/INSTALL_PRECOMPILED: -------------------------------------------------------------------------------- 1 | Installation instructions 2 | ------------------------- 3 | 4 | In order to install this distribution of Rice Wavelet Tools version 2.3 5 | released - 6 | 7 | 1. Make a toolbox directory and uncompress/extract all the files. 8 | For example, in the unix environment, 9 | 10 | gunzip rwt.tar.gz 11 | tar xvf rwt.tar 12 | 13 | 2. Add the toolbox directory to your Matlab path. 14 | 15 | 3. For further instructions, please refer to the README file. 16 | 17 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/lib/inc/rwt_transforms.h: -------------------------------------------------------------------------------- 1 | /*! \file rwt_transforms.h 2 | \brief Function prototypes for the transform implementations 3 | */ 4 | #ifndef TRANSFORMS_H_ 5 | #define TRANSFORMS_H_ 6 | 7 | #include 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /*! dwt and rdwt take an input x and store the result in y or yl and yh 14 | * idwt and irdwt take an input y or yl and yh and store the result in x 15 | * In all cases it is expected that the output array has already been 16 | * allocated prior to calling the transform function. 17 | */ 18 | void dwt(double *x, size_t nrows, size_t ncols, double *h, int ncoeff, int levels, double *y); 19 | void idwt(double *x, size_t nrows, size_t ncols, double *h, int ncoeff, int levels, double *y); 20 | void rdwt(double *x, size_t nrows, size_t ncols, double *h, int ncoeff, int levels, double *yl, double *yh); 21 | void irdwt(double *x, size_t nrows, size_t ncols, double *h, int ncoeff, int levels, double *yl, double *yh); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif /* TRANSFORMS_H_ */ 28 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/lib/src/platform.c: -------------------------------------------------------------------------------- 1 | /*! \file platform.c 2 | \brief Wrap memory allocation routines so that we can use the MATLAB ones when we build for MATLAB. 3 | 4 | rwt_malloc, rwt_calloc, and rwt_free simply wrap the MATLAB or system versions of malloc, calloc, and free. 5 | */ 6 | 7 | #include "rwt_platform.h" 8 | 9 | #if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE) 10 | void *rwt_malloc(size_t size) { 11 | return mxMalloc(size); 12 | } 13 | void *rwt_calloc(size_t num, size_t size) { 14 | return mxCalloc(num, size); 15 | } 16 | void rwt_free(void *ptr) { 17 | mxFree(ptr); 18 | } 19 | #else 20 | void *rwt_malloc(size_t size) { 21 | return malloc(size); 22 | } 23 | void *rwt_calloc(size_t num, size_t size) { 24 | return calloc(num, size); 25 | } 26 | void rwt_free(void *ptr) { 27 | free(ptr); 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/Readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/class_diagram_a.vsd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/class_diagram_a.vsd -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/class_diagram_b.vsd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/class_diagram_b.vsd -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/class_diagram_c.vsd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/class_diagram_c.vsd -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/html/class_diagram_a.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/html/class_diagram_a.gif -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/html/class_diagram_b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/html/class_diagram_b.gif -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/html/class_diagram_c.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/html/class_diagram_c.gif -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/architecture/testSample.m: -------------------------------------------------------------------------------- 1 | function test_suite = testSample 2 | initTestSuite; 3 | 4 | function testMyCode 5 | assertEqual(1, 1); 6 | assertElementsAlmostEqual(1, 1.1); 7 | assertTrue(10 == 10); -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/+abc/+tests/test_that.m: -------------------------------------------------------------------------------- 1 | % Do-nothing test used in the examples for organizing tests inside packages. 2 | % 3 | % Steven L. Eddins 4 | % Copyright 2010 The MathWorks, Inc. 5 | 6 | function test_that 7 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/+abc/+tests/test_this.m: -------------------------------------------------------------------------------- 1 | % Do-nothing test used in the examples for organizing tests inside packages. 2 | % 3 | % Steven L. Eddins 4 | % Copyright 2010 The MathWorks, Inc. 5 | 6 | function test_this 7 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/+abc_tests/test_that.m: -------------------------------------------------------------------------------- 1 | % Do-nothing test used in the examples for organizing tests inside packages. 2 | % 3 | % Steven L. Eddins 4 | % Copyright 2010 The MathWorks, Inc. 5 | 6 | function test_that 7 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/+abc_tests/test_this.m: -------------------------------------------------------------------------------- 1 | % Do-nothing test used in the examples for organizing tests inside packages. 2 | % 3 | % Steven L. Eddins 4 | % Copyright 2010 The MathWorks, Inc. 5 | 6 | function test_this 7 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/exRunSpecificTest.m: -------------------------------------------------------------------------------- 1 | %% <../index.html MATLAB xUnit Test Framework>: How to Run a Specific Test 2 | % To run all the test cases in just one M-file, ignoring other test 3 | % cases that might be in other files in the same directory, give 4 | % the name of the file (without the ".m" extension) as an argument 5 | % to |runtests|. 6 | % 7 | % For example 8 | 9 | cd example_subfunction_tests 10 | 11 | runtests testFliplr 12 | 13 | %% 14 | % To run a single test case, add the name of the test case using a 15 | % colon (":"), like this: 16 | 17 | runtests testFliplr:testFliplrVector 18 | 19 | %% 20 | % <../index.html Back to MATLAB xUnit Test Framework> 21 | 22 | %% 23 | % Copyright 2008-2010 The MathWorks, Inc. 24 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/exRunTestsInADirectory.m: -------------------------------------------------------------------------------- 1 | %% <../index.html MATLAB xUnit Test Framework>: How to Run Tests in Specific Directories 2 | % To run all the test cases in a specific directory, give the name of the 3 | % directory as an argument to |runtests|. 4 | % 5 | % For example 6 | 7 | runtests example_subfunction_tests 8 | 9 | %% 10 | % To run tests in multiple directories, give each directory name as a separate 11 | % argument to |runtests|. 12 | 13 | %% 14 | % <../index.html Back to MATLAB xUnit Test Framework> 15 | 16 | %% 17 | % Copyright 2008-2010 The MathWorks, Inc. 18 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/exRunTestsInPackage.m: -------------------------------------------------------------------------------- 1 | %% <../index.html MATLAB xUnit Test Framework>: How to Run Tests in a Package 2 | % To run all the test cases in a package, give the name of the 3 | % package as an argument to |runtests|. *Note:* Running tests in a package 4 | % requires MATLAB R2009a or later. 5 | % 6 | % For example, suppose you are distributing a set of MATLAB files called the 7 | % "ABC Toolbox." Then you could put your tests inside a package called abc_tests 8 | % and run them like this: 9 | 10 | runtests abc_tests 11 | 12 | %% 13 | % (Note that the initial "+" character in the name of the package folder on disk 14 | % is not part of the package name.) 15 | % 16 | % Or you could put your tests inside a subpackage called abc.tests and run them 17 | % like this: 18 | 19 | runtests abc.tests 20 | 21 | %% 22 | % You should not use a generic top-level package name such "tests" because then 23 | % your package might be unintentionally combined with packages with the same 24 | % name created by other people. 25 | 26 | %% 27 | % <../index.html Back to MATLAB xUnit Test Framework> 28 | 29 | %% 30 | % Copyright 2010 The MathWorks, Inc. 31 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/exSubfunctionTests.m: -------------------------------------------------------------------------------- 1 | %% <../index.html MATLAB xUnit Test Framework>: How to Put Multiple Test Cases in One M-file 2 | % The Quick Start example showed how you can write a simple M-file 3 | % to be a single test case. This example shows you how to put multiple 4 | % test cases in one M-file. 5 | % 6 | % Name your M-file beginning or ending with "test", like 7 | % "testMyFunc". Start by putting the following two lines at the 8 | % beginning of the file. It's important that the output variable 9 | % name on line 1 be |test_suite|. 10 | % 11 | % function test_suite = testMyFunc 12 | % initTestSuite; 13 | % 14 | % Next, add subfunctions to the file. Each subfunction beginning 15 | % or ending with "test" becomes an individual test case. 16 | % 17 | % The directory example_subfunction_tests contains a test M-file 18 | % containing subfunction test cases for the |fliplr| function. 19 | 20 | cd example_subfunction_tests 21 | 22 | type testFliplr 23 | 24 | %% 25 | % As usual, run the test cases using |runtests|: 26 | 27 | runtests 28 | 29 | %% 30 | % <../index.html Back to MATLAB xUnit Test Framework> 31 | 32 | %% 33 | % Copyright 2008-2010 The MathWorks, Inc. -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/example_quick_start/testFliplrMatrix.m: -------------------------------------------------------------------------------- 1 | function testFliplrMatrix 2 | %testFliplrMatrix Unit test for fliplr with matrix input 3 | 4 | in = magic(3); 5 | assertEqual(fliplr(in), in(:, [3 2 1])); 6 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/example_quick_start/testFliplrVector.m: -------------------------------------------------------------------------------- 1 | function testFliplrVector 2 | %testFliplrVector Unit test for fliplr with vector input 3 | 4 | in = [1 4 10]; 5 | out = fliplr(in); 6 | expected_out = [10 4 1]; 7 | 8 | if ~isequal(out, expected_out) 9 | error('testFliplrVector:notEqual', 'Incorrect output for vector.'); 10 | end 11 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/example_subfunction_tests/testFliplr.m: -------------------------------------------------------------------------------- 1 | function test_suite = testFliplr 2 | initTestSuite; 3 | 4 | function testFliplrMatrix 5 | in = magic(3); 6 | assertEqual(fliplr(in), in(:, [3 2 1])); 7 | 8 | function testFliplrVector 9 | assertEqual(fliplr([1 4 10]), [10 4 1]); 10 | 11 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/examples_general/TestUsingTestCase.m: -------------------------------------------------------------------------------- 1 | classdef TestUsingTestCase < TestCase 2 | 3 | properties 4 | fh 5 | end 6 | 7 | methods 8 | function self = TestUsingTestCase(name) 9 | self = self@TestCase(name); 10 | end 11 | 12 | function setUp(self) 13 | self.fh = figure; 14 | end 15 | 16 | function tearDown(self) 17 | delete(self.fh); 18 | end 19 | 20 | function testColormapColumns(self) 21 | assertEqual(size(get(self.fh, 'Colormap'), 2), 3); 22 | end 23 | 24 | function testPointer(self) 25 | assertEqual(get(self.fh, 'Pointer'), 'arrow'); 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/examples_general/testBadSinTest.m: -------------------------------------------------------------------------------- 1 | function test_suite = testBadSinTest 2 | initTestSuite; 3 | 4 | function testSinPi 5 | % Example of a failing test case. The test writer should have used 6 | % assertAlmostEqual here. 7 | assertEqual(sin(pi), 0); 8 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/examples_general/testCos.m: -------------------------------------------------------------------------------- 1 | function test_suite = testCos 2 | initTestSuite; 3 | 4 | function testTooManyInputs 5 | assertExceptionThrown(@() cos(1, 2), 'MATLAB:maxrhs'); -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/examples_general/testSetupExample.m: -------------------------------------------------------------------------------- 1 | function test_suite = testSetupExample 2 | initTestSuite; 3 | 4 | function fh = setup 5 | fh = figure; 6 | 7 | function teardown(fh) 8 | delete(fh); 9 | 10 | function testColormapColumns(fh) 11 | assertEqual(size(get(fh, 'Colormap'), 2), 3); 12 | 13 | function testPointer(fh) 14 | assertEqual(get(fh, 'Pointer'), 'arrow'); 15 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/examples_general/testSin.m: -------------------------------------------------------------------------------- 1 | function testSin 2 | 3 | assertElementsAlmostEqual(sin(pi), 0); -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/examples_general/testWithSetupError.m: -------------------------------------------------------------------------------- 1 | function test_suite = testWithSetupError 2 | %Example of a test with an error. The setup function calls cos with 3 | %too many input arguments. 4 | 5 | initTestSuite; 6 | 7 | function testData = setup 8 | testData = cos(1, 2); 9 | 10 | function testMyFeature(testData) 11 | assertEqual(1, 1); 12 | 13 | function teardown(testData) 14 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/obsolete/+mtest/+utils/Contents.m: -------------------------------------------------------------------------------- 1 | % UTILS Utility package for MTEST unit testing framework 2 | % 3 | % Array Comparison 4 | % compareFloats - Compare floating-point arrays using tolerance 5 | % 6 | % Test Case Discovery Functions 7 | % isTestCaseSubclass - True for name of TestCase subclass 8 | % 9 | % String Functions 10 | % containsRegexp - True if string contains regular expression 11 | % isSetUpString - True for string that looks like a setup function 12 | % isTearDownString - True for string that looks like teardown function 13 | % isTestString - True for string that looks like a test function 14 | % 15 | % Miscellaneous Functions 16 | % generateDoc - Publish test scripts in mtest/doc 17 | % parseFloatAssertInputs - Common input-parsing logic for several functions 18 | 19 | % Undocumented Functions 20 | % isAlmostEqual - Floating-point equality test using relative tolerance 21 | 22 | % Steven L. Eddins 23 | % Copyright 2008-2009 The MathWorks, Inc. 24 | 25 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/obsolete/+mtest/+utils/containsRegexp.m: -------------------------------------------------------------------------------- 1 | function tf = containsRegexp(str, exp) 2 | %containsRegexp True if string contains regular expression 3 | % TF = containsRegexp(str, exp) returns true if the string str contains the 4 | % regular expression exp. If str is a cell array of strings, then 5 | % containsRegexp tests each string in the cell array, returning the results in 6 | % a logical array with the same size as str. 7 | 8 | % Steven L. Eddins 9 | % Copyright 2008-2009 The MathWorks, Inc. 10 | 11 | % Convert to canonical input form: A cell array of strings. 12 | if ~iscell(str) 13 | str = {str}; 14 | end 15 | 16 | matches = regexp(str, exp); 17 | tf = ~cellfun('isempty', matches); 18 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/obsolete/+mtest/+utils/generateDoc.m: -------------------------------------------------------------------------------- 1 | function generateDoc 2 | %generateDoc Publish the example scripts in the doc directory 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008-2009 The MathWorks, Inc. 6 | 7 | doc_dir = fullfile(fileparts(which('mtest')), '..', 'doc'); 8 | addpath(doc_dir); 9 | cd(doc_dir) 10 | mfiles = dir('*.m'); 11 | for k = 1:numel(mfiles) 12 | publish(mfiles(k).name); 13 | cd(doc_dir) 14 | end 15 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/obsolete/+mtest/+utils/isSetUpString.m: -------------------------------------------------------------------------------- 1 | function tf = isSetUpString(str) 2 | %isSetUpString True if string looks like the name of a setup function 3 | % tf = isSetUpString(str) returns true if the string str looks like the name 4 | % of a setup function. If str is a cell array of strings, then isSetUpString 5 | % tests each string in the cell array, returning the results in a logical 6 | % array with the same size as str. 7 | 8 | % Steven L. Eddins 9 | % Copyright 2008-2009 The MathWorks, Inc. 10 | 11 | setup_exp = '^[sS]et[uU]p'; 12 | tf = mtest.utils.containsRegexp(str, setup_exp); 13 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/obsolete/+mtest/+utils/isTearDownString.m: -------------------------------------------------------------------------------- 1 | function tf = isTearDownString(str) 2 | %isTearDownString True if string looks like the name of a teardown function 3 | % tf = isTearDownString(str) returns true if the string str looks like the 4 | % name of a teardown function. If str is a cell array of strings, then 5 | % isTearDownString tests each string in the cell array, returning the results 6 | % in a logical array with the same size as str. 7 | 8 | % Steven L. Eddins 9 | % Copyright 2008-2009 The MathWorks, Inc. 10 | 11 | setup_exp = '^[tT]ear[dD]own'; 12 | tf = mtest.utils.containsRegexp(str, setup_exp); 13 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/obsolete/+mtest/+utils/isTestCaseSubclass.m: -------------------------------------------------------------------------------- 1 | function tf = isTestCaseSubclass(name) 2 | %isTestCaseSubclass True for name of a TestCase subclass 3 | % tf = isTestCaseSubclass(name) returns true if the string name is the name of 4 | % a TestCase subclass on the MATLAB path. 5 | 6 | % Steven L. Eddins 7 | % Copyright 2008-2009 The MathWorks, Inc. 8 | 9 | tf = false; 10 | 11 | class_meta = meta.class.fromName(name); 12 | if isempty(class_meta) 13 | % Not the name of a class 14 | return; 15 | end 16 | 17 | if strcmp(class_meta.Name, 'TestCase') 18 | tf = true; 19 | else 20 | tf = isMetaTestCaseSubclass(class_meta); 21 | end 22 | 23 | function tf = isMetaTestCaseSubclass(class_meta) 24 | 25 | tf = false; 26 | 27 | if strcmp(class_meta.Name, 'TestCase') 28 | tf = true; 29 | else 30 | % Invoke function recursively on parent classes. 31 | super_classes = class_meta.SuperClasses; 32 | for k = 1:numel(super_classes) 33 | if isMetaTestCaseSubclass(super_classes{k}) 34 | tf = true; 35 | break; 36 | end 37 | end 38 | end 39 | 40 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/obsolete/+mtest/+utils/isTestString.m: -------------------------------------------------------------------------------- 1 | function tf = isTestString(str) 2 | %isTestString True if string looks like the name of a test 3 | % tf = isTestString(str) returns true if the string str looks like the name of 4 | % a test. If str is a cell array of strings, then isTestString tests each 5 | % string in the cell array, returning the results in a logical array with the 6 | % same size as str. 7 | 8 | % Steven L. Eddins 9 | % Copyright 2008-2009 The MathWorks, Inc. 10 | 11 | test_exp = '^[tT]est'; 12 | tf = mtest.utils.containsRegexp(str, test_exp); 13 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/obsolete/tests/cwd_test/TestCaseSubclass.m: -------------------------------------------------------------------------------- 1 | %TestCaseSubclass TestCase subclass containing two passing tests 2 | 3 | % Steven L. Eddins 4 | % Copyright 2008 The MathWorks, Inc. 5 | 6 | classdef TestCaseSubclass < TestCase 7 | methods 8 | function self = TestCaseSubclass(name) 9 | self = self@TestCase(name); 10 | end 11 | 12 | function testA(self) 13 | end 14 | 15 | function testB(self) 16 | % Intentionally fail this test case. 17 | assertFalse(true); 18 | end 19 | end 20 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/obsolete/tests/cwd_test/testFoobar.m: -------------------------------------------------------------------------------- 1 | function testFoobar 2 | %testFoobar Passing M-file test 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/obsolete/tests/cwd_test/testSubfunctions.m: -------------------------------------------------------------------------------- 1 | function test_cases = testSubfunctions 2 | %testSubfunctions Contains two passing subfunction tests 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | findSubfunctionTests; 8 | 9 | function testSub1 10 | 11 | function testSub2 12 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/+xunit/+mocktests/+subpkg/test_a_bit.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_a_bit 2 | initTestSuite 3 | 4 | function test_now 5 | 6 | function test_later 7 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/+xunit/+mocktests/A.m: -------------------------------------------------------------------------------- 1 | % Class A is a TestCase subclass containing two test cases (test_a and test_b). 2 | classdef A < TestCase 3 | 4 | methods 5 | function self = A(name) 6 | self = self@TestCase(name); 7 | end 8 | 9 | function test_a(self) 10 | end 11 | 12 | function test_b(self) 13 | end 14 | end 15 | 16 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/+xunit/+mocktests/B.m: -------------------------------------------------------------------------------- 1 | % Class B is not a TestCase subclass. 2 | 3 | classdef B 4 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/+xunit/+mocktests/FooTest.m: -------------------------------------------------------------------------------- 1 | classdef FooTest < TestCase 2 | methods 3 | function object = FooTest(name) 4 | object = object@TestCase(name); 5 | end 6 | function test_sanity(object) 7 | assertEqual(0, 0) 8 | end 9 | end 10 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/+xunit/+mocktests/helper_that.m: -------------------------------------------------------------------------------- 1 | % helper_that is not a test file. 2 | 3 | function y = helper_that(x) 4 | y = x; 5 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/+xunit/+mocktests/test_that.m: -------------------------------------------------------------------------------- 1 | % test_that.m is a subfunction test file. 2 | function test_suite = test_this 3 | initTestSuite 4 | 5 | function test_the_other 6 | a = magic(3); 7 | 8 | function test_nifty 9 | b = magic(5); 10 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/+xunit/+mocktests/test_this.m: -------------------------------------------------------------------------------- 1 | % test_this.m is a function-file test case. 2 | function test_this -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/Readme.m: -------------------------------------------------------------------------------- 1 | % This directory contains the test suite for the mUnit test framework. Before 2 | % running the test suite, do the following: 3 | % 4 | % 1. Make sure the mUnit test framework directory is on your path 5 | % 2. Make sure the helper_classes subdirectory of the test directory is on 6 | % your path. 7 | % 3. Make the test directory your current directory. 8 | % 9 | % To run the test suite: 10 | % 11 | % run(TestSuite()) 12 | 13 | % Steven L. Eddins 14 | % Copyright 2008 The MathWorks 15 | 16 | help Readme -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/TestCaseWithAddPathTest.m: -------------------------------------------------------------------------------- 1 | %TestCaseTest Unit tests for the TestCaseWithAddPath class 2 | 3 | % Steven L. Eddins 4 | % Copyright The MathWorks 2008 5 | 6 | classdef TestCaseWithAddPathTest < TestCaseWithAddPath 7 | 8 | methods 9 | function self = TestCaseWithAddPathTest(name) 10 | self = self@TestCaseWithAddPath(name, ... 11 | fullfile(fileparts(which(mfilename)), 'helper_classes')); 12 | end 13 | 14 | function testPath(self) 15 | % Verify that a function in helper_classes is seen on the path. 16 | assertEqual(exist('testFunctionHandlesA', 'file'), 2); 17 | end 18 | 19 | function testRunTestOnPath(self) 20 | % Verify that we can make a test suite and run it using a file 21 | % in the new path directory. 22 | logger = TestRunLogger(); 23 | suite = TestSuite('testFunctionHandlesA'); 24 | did_pass = suite.run(logger); 25 | assertTrue(did_pass); 26 | end 27 | end 28 | 29 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/almost_black.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/almost_black.tif -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/black.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/black.tif -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/cwd_test/TestCaseSubclass.m: -------------------------------------------------------------------------------- 1 | %TestCaseSubclass TestCase subclass containing two passing tests 2 | 3 | % Steven L. Eddins 4 | % Copyright 2008 The MathWorks, Inc. 5 | 6 | classdef TestCaseSubclass < TestCase 7 | methods 8 | function self = TestCaseSubclass(name) 9 | self = self@TestCase(name); 10 | end 11 | 12 | function testA(self) 13 | end 14 | 15 | function testB(self) 16 | % Intentionally fail this test case. 17 | assertFalse(true); 18 | end 19 | end 20 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/cwd_test/testFoobar.m: -------------------------------------------------------------------------------- 1 | function testFoobar 2 | %testFoobar Passing M-file test 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/cwd_test/testSubfunctions.m: -------------------------------------------------------------------------------- 1 | function test_suite = testSubfunctions 2 | %testSubfunctions Contains two passing subfunction tests 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function testSub1 10 | 11 | function testSub2 12 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/dir1/test_thatPasses.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_thatPasses 2 | initTestSuite; 3 | 4 | function test_case 5 | assertTrue(true); 6 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/dir2/test_thatFails.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_thatFails 2 | initTestSuite; 3 | 4 | function test_case 5 | assertTrue(false); 6 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/empty_file: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/empty_file -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/BadFixture.m: -------------------------------------------------------------------------------- 1 | classdef BadFixture < TestCase 2 | 3 | methods 4 | function self = BadFixture(name) 5 | self = self@TestCase(name); 6 | end 7 | 8 | function setUp(self) 9 | throw(MException('setUpError:BadFixture', ... 10 | 'BadFixture setUp method always throws exception')); 11 | end 12 | 13 | function testMethod(self) 14 | end 15 | end 16 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/Contents.m: -------------------------------------------------------------------------------- 1 | % Helper Classes for mUnit Test Suite 2 | % 3 | % TestCase Subclasses 4 | % BadFixture - Contains setUp method that throws exception 5 | % FailingTestCase - Contains one test method that throws exception 6 | % LoggingTestCase - Logs calls to setUp, tearDown, and test method 7 | % NoTestMethods - TestCase subclass that contains no test methods 8 | % TestsToBeDiscovered - Used in TestSuiteTest 9 | % TwoPassingTests - Contains two passing test methods 10 | 11 | % Steven L. Eddins 12 | % Copyright 2008 The MathWorks, Inc. -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/ExceptionNotThrownTest.m: -------------------------------------------------------------------------------- 1 | classdef ExceptionNotThrownTest < TestCase 2 | methods 3 | function self = ExceptionNotThrownTest(methodName) 4 | self = self@TestCase(methodName); 5 | end 6 | 7 | function testThrowsException(self) 8 | f = @() []; 9 | assertExceptionThrown(f, 'a:b:c'); 10 | end 11 | end 12 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/FailingTestCase.m: -------------------------------------------------------------------------------- 1 | % FailingTestCase 2 | % Utility class used by unit tests. 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | classdef FailingTestCase < TestCase 8 | 9 | methods 10 | function self = FailingTestCase(name) 11 | self = self@TestCase(name); 12 | end 13 | 14 | function testFail(self) 15 | throw(MException('testFail:FailingTestCase', ... 16 | 'testFail always fails')); 17 | end 18 | end 19 | 20 | end 21 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/LoggingTestCase.m: -------------------------------------------------------------------------------- 1 | % LoggingTestCase 2 | % Utility class used by unit tests. 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | classdef LoggingTestCase < TestCase 8 | 9 | properties 10 | log = {}; 11 | end 12 | 13 | methods 14 | function self = LoggingTestCase(name) 15 | self = self@TestCase(name); 16 | end 17 | 18 | function setUp(self) 19 | self.log{end + 1} = 'setUp'; 20 | end 21 | 22 | function tearDown(self) 23 | self.log{end + 1} = 'tearDown'; 24 | end 25 | 26 | function testMethod(self) 27 | self.log{end + 1} = 'testMethod'; 28 | end 29 | 30 | function testBrokenMethod(self) 31 | throw(MException('brokenMethod:WasRun', ... 32 | 'Call to testBrokenMethod always throws exception')); 33 | end 34 | end 35 | 36 | end 37 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/NoTestMethods.m: -------------------------------------------------------------------------------- 1 | classdef NoTestMethods < TestCase 2 | methods 3 | function self = NoTestMethods(name) 4 | self = self@TestCase(name); 5 | end 6 | end 7 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/PassingExceptionTest.m: -------------------------------------------------------------------------------- 1 | classdef PassingExceptionTest < TestCase 2 | methods 3 | function self = PassingExceptionTest(methodName) 4 | self = self@TestCase(methodName); 5 | end 6 | 7 | function testThrowsException(self) 8 | f = @() error('a:b:c', 'error message'); 9 | assertExceptionThrown(f, 'a:b:c'); 10 | end 11 | end 12 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/TestsToBeDiscovered.m: -------------------------------------------------------------------------------- 1 | classdef TestsToBeDiscovered < TestCase 2 | 3 | methods 4 | function self = TestsToBeDiscovered(name) 5 | self = self@TestCase(name); 6 | end 7 | 8 | function testMethodA 9 | end 10 | 11 | function testMethodB 12 | end 13 | 14 | function notATestMethod 15 | end 16 | 17 | end 18 | 19 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/TwoPassingTests.m: -------------------------------------------------------------------------------- 1 | classdef TwoPassingTests < TestCase 2 | 3 | methods 4 | function self = TwoPassingTests(name) 5 | self = self@TestCase(name); 6 | end 7 | 8 | function testMethod1(self) 9 | end 10 | 11 | function testMethod2(self) 12 | end 13 | end 14 | 15 | end 16 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/WrongExceptionThrownTest.m: -------------------------------------------------------------------------------- 1 | classdef WrongExceptionThrownTest < TestCase 2 | methods 3 | function self = WrongExceptionThrownTest(methodName) 4 | self = self@TestCase(methodName); 5 | end 6 | 7 | function testThrowsException(self) 8 | f = @() error('d:e:f', 'message'); 9 | assertExceptionThrown(f, 'a:b:c'); 10 | end 11 | end 12 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/notTestString.m: -------------------------------------------------------------------------------- 1 | function suite = notTestString 2 | % This function exists to help test that the TestSuite.fromPwd() method does not 3 | % pick up function-handle test files that do not match the naming convention. 4 | initTestSuite; 5 | 6 | function testA 7 | 8 | function testB 9 | 10 | 11 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/testFunctionHandlesA.m: -------------------------------------------------------------------------------- 1 | function test_suite = testFunctionHandlesA 2 | %testFunctionHandlesA Test file used by TestFunctionHandlesTest 3 | % Contains two passing tests. 4 | 5 | % Steven L. Eddins 6 | % Copyright 2008 The MathWorks, Inc. 7 | 8 | initTestSuite; 9 | 10 | function testA 11 | 12 | function testB 13 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/testFunctionHandlesB.m: -------------------------------------------------------------------------------- 1 | function test_suite = testFunctionHandlesB 2 | %testFunctionHandlesB Test file used by TestFunctionHandlesTest 3 | % Contains two passing tests that use a test fixture. 4 | 5 | % Steven L. Eddins 6 | % Copyright 2008 The MathWorks, Inc. 7 | 8 | initTestSuite; 9 | 10 | function testData = setUpFcn 11 | testData = 5; 12 | 13 | function testA(testData) 14 | assertEqual(testData, 5); 15 | 16 | function testB(testData) 17 | assertEqual(testData, 5); 18 | 19 | function tearDownFcn(testData) 20 | assertEqual(testData, 5); 21 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/testFunctionHandlesC.m: -------------------------------------------------------------------------------- 1 | function test_suite = testFunctionHandlesC 2 | %testFunctionHandlesC Test file used by TestFunctionHandlesTest 3 | % Contains two passing tests that use a test fixture containing an intentional 4 | % error. 5 | 6 | % Steven L. Eddins 7 | % Copyright 2008 The MathWorks, Inc. 8 | 9 | initTestSuite; 10 | 11 | function testData = setUpFcn 12 | testData = 5; 13 | 14 | function testA(testData) 15 | assertEqual(testData, 5); 16 | 17 | function testB(testData) 18 | assertEqual(testData, 5); 19 | 20 | function tearDownFcn(testData) 21 | % This assertion is expected to error. 22 | assertEqual(testData, 20); 23 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/testFunctionHandlesD.m: -------------------------------------------------------------------------------- 1 | function test_suite = testFunctionHandlesD 2 | %testFunctionHandlesD Test file used by TestFunctionHandlesTest 3 | % Contains two passing tests that use a test fixture with no test data. 4 | 5 | % Steven L. Eddins 6 | % Copyright 2008 The MathWorks, Inc. 7 | 8 | initTestSuite; 9 | 10 | function setUpFcn 11 | 12 | 13 | function testA(varargin) 14 | assertTrue(isempty(varargin)); 15 | 16 | function testB(varargin) 17 | assertTrue(isempty(varargin)); 18 | 19 | function tearDownFcn(varargin) 20 | assertTrue(isempty(varargin)); 21 | 22 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/testFunctionHandlesE.m: -------------------------------------------------------------------------------- 1 | function test_suite = testFunctionHandlesA 2 | %testFunctionHandlesE Test file used by TestFunctionHandlesTest 3 | % Contains one failing test. 4 | 5 | % Steven L. Eddins 6 | % Copyright 2008 The MathWorks, Inc. 7 | 8 | initTestSuite; 9 | 10 | function testA 11 | error('testFunctionHandlesA:expectedFailure', 'Bogus message'); 12 | 13 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/testFunctionHandlesTeardownNoSetup.m: -------------------------------------------------------------------------------- 1 | function suite = testFunctionHandlesTeardownNoSetup 2 | % Verify that test file works if it has a teardown function but no setup 3 | % function. 4 | initTestSuite; 5 | 6 | function teardown 7 | close all 8 | 9 | function test_normalCase 10 | assertEqual(1, 1); 11 | 12 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/helper_classes/testSimple.m: -------------------------------------------------------------------------------- 1 | function testSimple 2 | %testSimple Simple M-file test that passes 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/testAssertExceptionThrown.m: -------------------------------------------------------------------------------- 1 | function test_suite = testAssertExceptionThrown 2 | %testAssertExceptionThrown Unit tests for assertExceptionThrown 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function test_happyCase 10 | assertExceptionThrown(... 11 | @() error('MyProd:MyFun:MyId', 'my message'), 'MyProd:MyFun:MyId'); 12 | 13 | function test_wrongException 14 | assertExceptionThrown(@() assertExceptionThrown(... 15 | @() error('MyProd:MyFun:MyId', 'my message'), ... 16 | 'MyProd:MyFun:DifferentId'), 'assertExceptionThrown:wrongException'); 17 | 18 | function test_noException 19 | assertExceptionThrown(@() assertExceptionThrown(@() sin(pi), 'foobar'), ... 20 | 'assertExceptionThrown:noException'); 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/testAssertFalse.m: -------------------------------------------------------------------------------- 1 | function test_suite = testAssertFalse 2 | %testAssertFalse Unit tests for assertFalse 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function testAssertFalseHappyCase 10 | assertFalse(false); 11 | 12 | function testAssertFalseHappyCaseWithTwoArgs 13 | assertFalse(false, '1.e4 e5 2.Nf3 Nc6'); 14 | 15 | function testAssertFalseFailed 16 | % Verify exception when false is passed to assertFalse. 17 | assertExceptionThrown(@() assertFalse(true), 'assertFalse:trueCondition'); 18 | 19 | function testAssertFalseNonscalar 20 | % Verify that assertFalse doesn't like nonscalar input. 21 | assertExceptionThrown(@() assertFalse(logical([0 0])), 'assertFalse:invalidCondition'); 22 | 23 | function testAssertFalseNonlogical 24 | % Verify that assertFalse doesn't like nonlogical input. 25 | assertExceptionThrown(@() assertFalse(0), 'assertFalse:invalidCondition'); 26 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/testAssertTrue.m: -------------------------------------------------------------------------------- 1 | function test_suite = testAssertTrue 2 | %testAssertTrue Unit tests for assertTrue 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function testAssertTrueHappyCase 10 | assertTrue(true); 11 | 12 | function testAssertTrueHappyCaseWithTwoArgs 13 | assertTrue(true, '1.e4 e5 2.Nf3 Nc6'); 14 | 15 | function testAssertTrueFailed 16 | % Verify exception when false is passed to assertTrue. 17 | assertExceptionThrown(@() assertTrue(false), 'assertTrue:falseCondition'); 18 | 19 | function testAssertTrueNonscalar 20 | % Verify that assertTrue doesn't like nonscalar input. 21 | assertExceptionThrown(@() assertTrue(logical([1 1])), 'assertTrue:invalidCondition'); 22 | 23 | function testAssertTrueNonlogical 24 | % Verify that assertTrue doesn't like nonlogical input. 25 | assertExceptionThrown(@() assertTrue(5), 'assertTrue:invalidCondition'); 26 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/testContainsRegexp.m: -------------------------------------------------------------------------------- 1 | function test_suite = testContainsRegexp 2 | %testContainsRegexp Unit tests for containsRegexp 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function testOneStringContains 10 | assertTrue(xunit.utils.containsRegexp('MATLAB is great', '[A-Z]')); 11 | 12 | function testOneStringDoesntContain 13 | assertTrue(~ xunit.utils.containsRegexp('no upper-case letters', '[A-Z]')); 14 | 15 | function testCellArray 16 | strs = {'MATLAB is great', 'no upper-case letters'}; 17 | assertEqual(xunit.utils.containsRegexp(strs, '[A-Z]'), [true false]); 18 | assertEqual(xunit.utils.containsRegexp(strs', '[A-Z]'), [true; false]); -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/testIsSetUpString.m: -------------------------------------------------------------------------------- 1 | function test_suite = testIsSetUpString 2 | %testIsSetUpString Unit tests for isSetUpString 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function testOneStringIs 10 | assertTrue(xunit.utils.isSetUpString('setup')); 11 | assertTrue(xunit.utils.isSetUpString('setUp_fixture')); 12 | 13 | function testOneStringIsNot 14 | assertFalse(xunit.utils.isSetUpString('bogus')); 15 | 16 | function testCellArray 17 | strs = {'setup', 'bogus'}; 18 | assertEqual(xunit.utils.isSetUpString(strs), [true false]); 19 | assertEqual(xunit.utils.isSetUpString(strs'), [true; false]); -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/testIsTearDownString.m: -------------------------------------------------------------------------------- 1 | function test_suite = testIsTearDownString 2 | %testIsTearDownString Unit tests for isTearDownString 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function testOneStringIs 10 | assertTrue(xunit.utils.isTearDownString('teardownfoobar')); 11 | assertTrue(xunit.utils.isTearDownString('TearDown_foobar')); 12 | 13 | function testOneStringIsNot 14 | assertFalse(xunit.utils.isTearDownString('tEardown')); 15 | 16 | function testCellArray 17 | strs = {'teardown', 'tearup'}; 18 | assertEqual(xunit.utils.isTearDownString(strs), [true false]); 19 | assertEqual(xunit.utils.isTearDownString(strs'), [true; false]); -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/testIsTestCaseSubclass.m: -------------------------------------------------------------------------------- 1 | function test_suite = testIsTestCaseSubclass 2 | %testIsTestCaseSubclass Unit tests for isTestCaseSubclass 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function testTestCase 10 | assertTrue(xunit.utils.isTestCaseSubclass('TestCase')); 11 | 12 | function testSubclass 13 | assertTrue(xunit.utils.isTestCaseSubclass('TestCaseInDir')); 14 | 15 | function testNotASubclass 16 | assertFalse(xunit.utils.isTestCaseSubclass('atan2')); -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/testIsTestString.m: -------------------------------------------------------------------------------- 1 | function test_suite = testIsTestString 2 | %testIsTestString Unit tests for isTestString 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function testOneStringIs 10 | assertTrue(xunit.utils.isTestString('testFoobar')); 11 | assertTrue(xunit.utils.isTestString('Test_foobar')); 12 | 13 | function testOneStringIsNot 14 | assertFalse(xunit.utils.isTestString('foobar')); 15 | 16 | function testCellArray 17 | strs = {'testFoobar', 'foobar_test', 'foobar', 'foobar_Test'}; 18 | assertEqual(xunit.utils.isTestString(strs), [true true false true]); 19 | assertEqual(xunit.utils.isTestString(strs'), [true; true; false; true]); -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/testRuntestsWithDirectoryName.m: -------------------------------------------------------------------------------- 1 | function test_suite = testRuntestsWithDirectoryName 2 | %testRuntestsWithDirectoryName Unit test for mtest('dirname') syntax. 3 | 4 | initTestSuite; 5 | 6 | function testDirName 7 | current_dir = pwd; 8 | target_dir = fullfile(fileparts(which(mfilename)), 'cwd_test'); 9 | [T, did_pass] = evalc('runtests(target_dir)'); 10 | assertFalse(did_pass); 11 | assertEqual(current_dir, pwd); 12 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/test_TestSuiteInDir.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_TestSuiteInDir 2 | %test_TestSuiteInDir Unit test for TestSuiteInDir class. 3 | 4 | % Steven L. Eddins 5 | % Copyright 2009 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function test_constructor 10 | this_test_path = fileparts(which(mfilename)); 11 | cwd_test_dir = fullfile(this_test_path, 'cwd_test'); 12 | suite = TestSuiteInDir(cwd_test_dir); 13 | 14 | assertEqual(suite.Name, 'cwd_test'); 15 | assertEqual(suite.Location, cwd_test_dir); 16 | 17 | function test_gatherTestCases 18 | this_test_path = fileparts(which(mfilename)); 19 | cwd_test_dir = fullfile(this_test_path, 'cwd_test'); 20 | suite = TestSuiteInDir(cwd_test_dir); 21 | suite.gatherTestCases(); 22 | 23 | assertEqual(numel(suite.TestComponents), 3); 24 | 25 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/test_arrayToString.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_arrayToString 2 | %test_arrayToString Unit test for arrayToString. 3 | 4 | % Steven L. Eddins 5 | % Copyright 2009 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function test_smallInput 10 | A = [1 2 3]; 11 | assertEqual(strtrim(xunit.utils.arrayToString(A)), '1 2 3'); 12 | 13 | function test_largeInput 14 | A = zeros(1000, 1000); 15 | assertEqual(xunit.utils.arrayToString(A), '[1000x1000 double]'); 16 | 17 | function test_emptyInput 18 | assertEqual(xunit.utils.arrayToString(zeros(1,0,2)), '[1x0x2 double]'); 19 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/test_assertFilesEqual.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_assertFilesEqual 2 | %test_assertFilesEqual Unit test for assertFilesEqual 3 | 4 | % Steven L. Eddins 5 | % Copyright 2009 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function test_equal 10 | assertFilesEqual('black.tif', 'black.tif'); 11 | 12 | function test_differentSize 13 | assertExceptionThrown(@() assertFilesEqual('black.tif', 'black.png'), ... 14 | 'assertFilesEqual:sizeMismatch'); 15 | 16 | function test_sameSizeButDifferent 17 | assertExceptionThrown(@() assertFilesEqual('black.tif', 'almost_black.tif'), ... 18 | 'assertFilesEqual:valuesDiffer'); 19 | 20 | function test_oneFileEmpty 21 | assertExceptionThrown(@() assertFilesEqual('empty_file', 'black.png'), ... 22 | 'assertFilesEqual:sizeMismatch'); 23 | 24 | function test_bothFilesEmpty 25 | assertFilesEqual('empty_file', 'empty_file'); 26 | 27 | function test_cannotReadFirstFile 28 | assertExceptionThrown(@() assertFilesEqual('bogus', 'black.png'), ... 29 | 'assertFilesEqual:readFailure'); 30 | 31 | function test_cannotReadSecondFile 32 | assertExceptionThrown(@() assertFilesEqual('black.png', 'bogus'), ... 33 | 'assertFilesEqual:readFailure'); 34 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/test_comparisonMessage.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_comparisonMessage 2 | %test_comparisonMessage Unit test for comparisonMessage. 3 | 4 | % Steven L. Eddins 5 | % Copyright 2009 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function test_happyCase 10 | s = xunit.utils.comparisonMessage('user message', 'assertion message', ... 11 | [1 2 3], 'hello'); 12 | c = xunit.utils.stringToCellArray(s); 13 | 14 | expected_output = { 'user message' 15 | 'assertion message' 16 | '' 17 | 'First input:' 18 | ' 1 2 3' 19 | '' 20 | 'Second input:' 21 | 'hello'}; 22 | 23 | assertEqual(c, expected_output); 24 | 25 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/test_packageName.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_packageName 2 | initTestSuite; 3 | 4 | function test_happyCase 5 | suite = TestSuite.fromPackageName('xunit.mocktests'); 6 | assertEqual(numel(suite.TestComponents), 5); 7 | 8 | assertEqual(numel(suite.TestComponents{1}.TestComponents), 1); 9 | assertEqual(suite.TestComponents{1}.Name, 'xunit.mocktests.subpkg'); 10 | 11 | assertEqual(numel(suite.TestComponents{2}.TestComponents), 2); 12 | assertEqual(suite.TestComponents{2}.Name, 'xunit.mocktests.A'); 13 | 14 | assertEqual(numel(suite.TestComponents{3}.TestComponents), 1); 15 | assertEqual(suite.TestComponents{3}.Name, 'xunit.mocktests.FooTest'); 16 | 17 | assertEqual(numel(suite.TestComponents{4}.TestComponents), 2); 18 | assertEqual(suite.TestComponents{4}.Name, 'test_that'); 19 | 20 | assertEqual(numel(suite.TestComponents{5}.TestComponents), 1); 21 | assertEqual(suite.TestComponents{5}.Name, 'xunit.mocktests.test_this'); 22 | 23 | function test_badPackageName 24 | assertExceptionThrown(@() TestSuite.fromPackageName('bogus'), ... 25 | 'xunit:fromPackageName:invalidName'); 26 | 27 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/tests/test_stringToCellArray.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_stringToCellArray 2 | %test_stringToCellArray Unit test for stringToCellArray 3 | 4 | % Steven L. Eddins 5 | % Copyright 2009 The MathWorks, Inc. 6 | 7 | initTestSuite; 8 | 9 | function test_happyCase 10 | s = sprintf('Hello\nWorld'); 11 | assertEqual(xunit.utils.stringToCellArray(s), {'Hello' ; 'World'}); 12 | 13 | function test_emptyInput 14 | assertEqual(xunit.utils.stringToCellArray(''), cell(0, 1)); 15 | 16 | function test_spacesInFront 17 | s = sprintf(' Hello\n World\n'); 18 | assertEqual(xunit.utils.stringToCellArray(s), {' Hello' ; ' World'}); 19 | 20 | function test_spacesAtEnd 21 | s = sprintf('Hello \nWorld '); 22 | assertEqual(xunit.utils.stringToCellArray(s), {'Hello ' ; 'World '}); 23 | 24 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/+xunit/+utils/Contents.m: -------------------------------------------------------------------------------- 1 | % UTILS Utility package for MATLAB xUnit Test Framework 2 | % 3 | % Array Comparison 4 | % compareFloats - Compare floating-point arrays using tolerance 5 | % 6 | % Test Case Discovery Functions 7 | % isTestCaseSubclass - True for name of TestCase subclass 8 | % 9 | % String Functions 10 | % arrayToString - Convert array to string for display 11 | % comparisonMessage - Assertion message string for comparing two arrays 12 | % containsRegexp - True if string contains regular expression 13 | % isSetUpString - True for string that looks like a setup function 14 | % isTearDownString - True for string that looks like teardown function 15 | % isTestString - True for string that looks like a test function 16 | % stringToCellArray - Convert string to cell array of strings 17 | % 18 | % Miscellaneous Functions 19 | % generateDoc - Publish test scripts in mtest/doc 20 | % parseFloatAssertInputs - Common input-parsing logic for several functions 21 | 22 | % Steven L. Eddins 23 | % Copyright 2008-2009 The MathWorks, Inc. 24 | 25 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/+xunit/+utils/comparisonMessage.m: -------------------------------------------------------------------------------- 1 | function msg = comparisonMessage(user_message, assertion_message, A, B) 2 | %comparisonMessage Generate assertion message when comparing two arrays. 3 | % msg = comparisonMessage(user_message, assertion_message, A, B) returns a 4 | % string appropriate to use in a call to throw inside an assertion function 5 | % that compares two arrays A and B. 6 | % 7 | % The string returned has the following form: 8 | % 9 | % 10 | % 11 | % 12 | % First input: 13 | % 14 | % 15 | % Second input: 16 | % 17 | % 18 | % user_message can be the empty string, '', in which case user_message is 19 | % skipped. 20 | 21 | % Steven L. Eddins 22 | % Copyright 2009 The MathWorks, Inc. 23 | 24 | msg = sprintf('%s\n\n%s\n%s\n\n%s\n%s', ... 25 | assertion_message, ... 26 | 'First input:', ... 27 | xunit.utils.arrayToString(A), ... 28 | 'Second input:', ... 29 | xunit.utils.arrayToString(B)); 30 | 31 | if ~isempty(user_message) 32 | msg = sprintf('%s\n%s', user_message, msg); 33 | end 34 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/+xunit/+utils/containsRegexp.m: -------------------------------------------------------------------------------- 1 | function tf = containsRegexp(str, exp) 2 | %containsRegexp True if string contains regular expression 3 | % TF = containsRegexp(str, exp) returns true if the string str contains the 4 | % regular expression exp. If str is a cell array of strings, then 5 | % containsRegexp tests each string in the cell array, returning the results in 6 | % a logical array with the same size as str. 7 | 8 | % Steven L. Eddins 9 | % Copyright 2008-2009 The MathWorks, Inc. 10 | 11 | % Convert to canonical input form: A cell array of strings. 12 | if ~iscell(str) 13 | str = {str}; 14 | end 15 | 16 | matches = regexp(str, exp); 17 | tf = ~cellfun('isempty', matches); 18 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/+xunit/+utils/generateDoc.m: -------------------------------------------------------------------------------- 1 | function generateDoc 2 | %generateDoc Publish the example scripts in the doc directory 3 | 4 | % Steven L. Eddins 5 | % Copyright 2008-2009 The MathWorks, Inc. 6 | 7 | doc_dir = fullfile(fileparts(which('runtests')), '..', 'doc'); 8 | addpath(doc_dir); 9 | cd(doc_dir) 10 | mfiles = dir('*.m'); 11 | for k = 1:numel(mfiles) 12 | publish(mfiles(k).name); 13 | cd(doc_dir) 14 | end 15 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/+xunit/+utils/isSetUpString.m: -------------------------------------------------------------------------------- 1 | function tf = isSetUpString(str) 2 | %isSetUpString True if string looks like the name of a setup function 3 | % tf = isSetUpString(str) returns true if the string str looks like the name 4 | % of a setup function. If str is a cell array of strings, then isSetUpString 5 | % tests each string in the cell array, returning the results in a logical 6 | % array with the same size as str. 7 | 8 | % Steven L. Eddins 9 | % Copyright 2008-2009 The MathWorks, Inc. 10 | 11 | setup_exp = '^[sS]et[uU]p'; 12 | tf = xunit.utils.containsRegexp(str, setup_exp); 13 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/+xunit/+utils/isTearDownString.m: -------------------------------------------------------------------------------- 1 | function tf = isTearDownString(str) 2 | %isTearDownString True if string looks like the name of a teardown function 3 | % tf = isTearDownString(str) returns true if the string str looks like the 4 | % name of a teardown function. If str is a cell array of strings, then 5 | % isTearDownString tests each string in the cell array, returning the results 6 | % in a logical array with the same size as str. 7 | 8 | % Steven L. Eddins 9 | % Copyright 2008-2009 The MathWorks, Inc. 10 | 11 | setup_exp = '^[tT]ear[dD]own'; 12 | tf = xunit.utils.containsRegexp(str, setup_exp); 13 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/+xunit/+utils/isTestCaseSubclass.m: -------------------------------------------------------------------------------- 1 | function tf = isTestCaseSubclass(name) 2 | %isTestCaseSubclass True for name of a TestCase subclass 3 | % tf = isTestCaseSubclass(name) returns true if the string name is the name of 4 | % a TestCase subclass on the MATLAB path. 5 | 6 | % Steven L. Eddins 7 | % Copyright 2008-2009 The MathWorks, Inc. 8 | 9 | tf = false; 10 | 11 | class_meta = meta.class.fromName(name); 12 | if isempty(class_meta) 13 | % Not the name of a class 14 | return; 15 | end 16 | 17 | if strcmp(class_meta.Name, 'TestCase') 18 | tf = true; 19 | else 20 | tf = isMetaTestCaseSubclass(class_meta); 21 | end 22 | 23 | function tf = isMetaTestCaseSubclass(class_meta) 24 | 25 | tf = false; 26 | 27 | if strcmp(class_meta.Name, 'TestCase') 28 | tf = true; 29 | else 30 | % Invoke function recursively on parent classes. 31 | super_classes = class_meta.SuperClasses; 32 | for k = 1:numel(super_classes) 33 | if isMetaTestCaseSubclass(super_classes{k}) 34 | tf = true; 35 | break; 36 | end 37 | end 38 | end 39 | 40 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/+xunit/+utils/isTestString.m: -------------------------------------------------------------------------------- 1 | function tf = isTestString(str) 2 | %isTestString True if string looks like the name of a test 3 | % tf = isTestString(str) returns true if the string str looks like the name of 4 | % a test. If str is a cell array of strings, then isTestString tests each 5 | % string in the cell array, returning the results in a logical array with the 6 | % same size as str. 7 | 8 | % Steven L. Eddins 9 | % Copyright 2008-2009 The MathWorks, Inc. 10 | 11 | test_at_beginning = '^[tT]est'; 12 | test_at_end = '[tT]est$'; 13 | 14 | tf = xunit.utils.containsRegexp(str, test_at_beginning) | ... 15 | xunit.utils.containsRegexp(str, test_at_end); 16 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/+xunit/+utils/stringToCellArray.m: -------------------------------------------------------------------------------- 1 | function c = stringToCellArray(s) 2 | %stringToCellArray Convert string with newlines to cell array of strings. 3 | % C = stringToCellArray(S) converts the input string S to a cell array of 4 | % strings, breaking up S at new lines. 5 | 6 | % Steven L. Eddins 7 | % Copyright 2009 The MathWorks, Inc. 8 | 9 | if isempty(s) 10 | c = cell(0, 1); 11 | else 12 | c = textscan(s, '%s', 'Delimiter', '\n', 'Whitespace', ''); 13 | c = c{1}; 14 | end 15 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/TestCaseInDir.m: -------------------------------------------------------------------------------- 1 | %TestCaseInDir Test case requiring temporary directory change 2 | % The TestCaseInDir class defines a test case that has to be run by first 3 | % changing to a specified directory. 4 | % 5 | % The setUp method adds the starting directory to the path and then uses cd to 6 | % change into the specified directory. The tearDown method restores the 7 | % original path and directory. 8 | % 9 | % TestCaseInDir is used by MATLAB xUnit's own test suite in order to test itself. 10 | % 11 | % TestCaseInDir methods: 12 | % TestCaseInDir - Constructor 13 | % 14 | % See also TestCase, TestCaseWithAddPath, TestComponent 15 | 16 | % Steven L. Eddins 17 | % Copyright 2008-2009 The MathWorks, Inc. 18 | 19 | classdef TestCaseInDir < TestCase & TestComponentInDir 20 | 21 | methods 22 | function self = TestCaseInDir(methodName, testDirectory) 23 | %TestCaseInDir Constructor 24 | % TestCaseInDir(testName, testDirectory) constructs a test case 25 | % using the specified name and located in the specified directory. 26 | self = self@TestCase(methodName); 27 | self = self@TestComponentInDir(testDirectory); 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/assertFalse.m: -------------------------------------------------------------------------------- 1 | function assertFalse(condition, message) 2 | %assertFalse Assert that input condition is false 3 | % assertFalse(CONDITION, MESSAGE) throws an exception containing the string 4 | % MESSAGE if CONDITION is not false. 5 | % 6 | % MESSAGE is optional. 7 | % 8 | % Examples 9 | % -------- 10 | % assertFalse(isreal(sqrt(-1))) 11 | % 12 | % assertFalse(isreal(sqrt(-1)), ... 13 | % 'Expected isreal(sqrt(-1)) to be false.') 14 | % 15 | % See also assertTrue 16 | 17 | % Steven L. Eddins 18 | % Copyright 2008-2010 The MathWorks, Inc. 19 | 20 | if nargin < 2 21 | message = 'Asserted condition is not false.'; 22 | end 23 | 24 | if ~isscalar(condition) || ~islogical(condition) 25 | throwAsCaller(MException('assertFalse:invalidCondition', ... 26 | 'CONDITION must be a scalar logical value.')); 27 | end 28 | 29 | if condition 30 | throwAsCaller(MException('assertFalse:trueCondition', '%s', message)); 31 | end 32 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/assertTrue.m: -------------------------------------------------------------------------------- 1 | function assertTrue(condition, message) 2 | %assertTrue Assert that input condition is true 3 | % assertTrue(CONDITION, MESSAGE) throws an exception containing the string 4 | % MESSAGE if CONDITION is not true. 5 | % 6 | % MESSAGE is optional. 7 | % 8 | % Examples 9 | % -------- 10 | % % This call returns silently. 11 | % assertTrue(rand < 1, 'Expected output of rand to be less than 1') 12 | % 13 | % % This call throws an error. 14 | % assertTrue(sum(sum(magic(3))) == 0, ... 15 | % 'Expected sum of elements of magic(3) to be 0') 16 | % 17 | % See also assertEqual, assertFalse 18 | 19 | % Steven L. Eddins 20 | % Copyright 2008-2010 The MathWorks, Inc. 21 | 22 | if nargin < 2 23 | message = 'Asserted condition is not true.'; 24 | end 25 | 26 | if ~isscalar(condition) || ~islogical(condition) 27 | throwAsCaller(MException('assertTrue:invalidCondition', ... 28 | 'CONDITION must be a scalar logical value.')); 29 | end 30 | 31 | if ~condition 32 | throwAsCaller(MException('assertTrue:falseCondition', '%s', message)); 33 | end 34 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/matlab_xunit/xunit/info.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | R2009a 7 | MATLAB xUnit Test Framework 8 | Other 9 | $toolbox/matlab/icons/matlabicon.gif 10 | ../doc/ 11 | 12 | 13 | 14 | 15 | 16 | doc xunit 17 | $toolbox/matlab/icons/book_mat.gif 18 | 19 | 20 | 21 | 22 | web http://www.mathworks.com/matlabcentral/fileexchange/22846 -browser; 23 | $toolbox/matlab/icons/webicon.gif 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/octave/assertEqual.m: -------------------------------------------------------------------------------- 1 | function [] = assertEqual(a, b) 2 | if (a != b) 3 | testFailed; 4 | end 5 | 6 | function [] = testFailed() 7 | [ST, I] = dbstack(2); 8 | disp(strcat("FAILED: ", ST(1).name)); 9 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/octave/assertVectorsAlmostEqual.m: -------------------------------------------------------------------------------- 1 | function [] = assertVectorsAlmostEqual(a, b, comparetype, tolerance) 2 | if (max(abs(reshape(a-b,[],1))) > tolerance) 3 | testFailed(a,b); 4 | elseif (min(size(a) == size(b)) < 1) 5 | testFailed(a,b); 6 | end 7 | 8 | function [] = testFailed(a, b) 9 | [ST, I] = dbstack(2); 10 | disp(strcat("FAILED: ", ST(1).name)); 11 | disp(a) 12 | disp("--") 13 | disp(b) 14 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/octave/runtests.m: -------------------------------------------------------------------------------- 1 | path('../../bin', path) 2 | test_mdwt 3 | test_midwt 4 | test_mirdwt 5 | test_mrdwt 6 | test_makesig 7 | test_denoise 8 | test_setopt 9 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/octave/test_midwt.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_midwt 2 | disp("midwt") 3 | test_midwt_1D 4 | test_midwt_2D 5 | 6 | function test_midwt_1D 7 | x = makesig('LinChirp',8); 8 | h = daubcqf(4,'min'); 9 | L = 2; 10 | [y,L] = mdwt(x,h,L); 11 | [x_new,L] = midwt(y,h,L); 12 | assertVectorsAlmostEqual(x, x_new,'relative',0.0001); 13 | 14 | function test_midwt_2D 15 | load ../lena512; 16 | x = lena512; 17 | h = daubcqf(6); 18 | [y,L] = mdwt(x,h); 19 | [x_new,L] = midwt(y,h); 20 | assertEqual(L,9); 21 | assertVectorsAlmostEqual(x, x_new,'relative',0.0001); 22 | 23 | 24 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/octave/test_mirdwt.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_mirdwt 2 | disp("mrdwt") 3 | test_mirdwt_1 4 | test_mirdwt_2 5 | 6 | function test_mirdwt_1 7 | xin = makesig('Leopold',8); 8 | h = daubcqf(4,'min'); 9 | Lin = 1; 10 | [yl,yh,L] = mrdwt(xin,h,Lin); 11 | [x,L] = mirdwt(yl,yh,h,L); 12 | 13 | assertEqual(L,Lin); 14 | assertVectorsAlmostEqual(x, xin,'relative',0.0001); 15 | 16 | function test_mirdwt_2 17 | load ../lena512; 18 | x = lena512; 19 | h = daubcqf(6); 20 | [yl,yh,L] = mrdwt(x,h); 21 | assertEqual(L,9); 22 | [x_new,L] = mirdwt(yl,yh,h); 23 | assertEqual(L,9); 24 | assertVectorsAlmostEqual(x, x_new,'relative',0.0001); 25 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/octave/test_setopt.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_setopt 2 | disp("setopt") 3 | test_setopt_all_defaults 4 | test_setopt_nonzero_becomes_zero 5 | 6 | function test_setopt_all_defaults 7 | x = []; 8 | default_opts = [5 6 7 8]; 9 | z = setopt(x, default_opts); 10 | z_corr = [5 6 7 8]; 11 | assertVectorsAlmostEqual(z, z_corr, 'relative', 0.0001); 12 | 13 | function test_setopt_nonzero_becomes_zero 14 | x = [1 0 3]; 15 | default_opts = [5 6 7 8]; 16 | z = setopt(x, default_opts); 17 | z_corr = [1 6 3 8]; 18 | %z_corr = [1 0 3 8]; % This would be more intuitive 19 | assertVectorsAlmostEqual(z, z_corr, 'relative', 0.0001); 20 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/runtests.m: -------------------------------------------------------------------------------- 1 | path(path, '../bin') 2 | path(path, 'matlab_xunit/xunit') 3 | test_mdwt 4 | test_midwt 5 | test_mirdwt 6 | test_mrdwt 7 | test_makesig 8 | test_denoise 9 | test_setopt 10 | test_daubcqf 11 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/test_midwt.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_midwt 2 | initTestSuite; 3 | 4 | 5 | 6 | function test_midwt_1D 7 | x = makesig('LinChirp',8); 8 | h = daubcqf(4,'min'); 9 | L = 2; 10 | [y,L] = mdwt(x,h,L); 11 | [x_new,L] = midwt(y,h,L); 12 | assertVectorsAlmostEqual(x, x_new,'relative',0.0001); 13 | 14 | function test_midwt_2D 15 | load lena512; 16 | x = lena512; 17 | h = daubcqf(6); 18 | [y,L] = mdwt(x,h); 19 | [x_new,L] = midwt(y,h); 20 | assertEqual(L,9); 21 | assertVectorsAlmostEqual(x, x_new,'relative',0.0001); 22 | 23 | 24 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/test_mirdwt.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_mirdwt 2 | initTestSuite; 3 | 4 | function test_mirdwt_1 5 | xin = makesig('Leopold',8); 6 | h = daubcqf(4,'min'); 7 | Lin = 1; 8 | [yl,yh,L] = mrdwt(xin,h,Lin); 9 | [x,L] = mirdwt(yl,yh,h,L); 10 | 11 | assertEqual(L,Lin); 12 | assertVectorsAlmostEqual(x, xin,'relative',0.0001); 13 | 14 | function test_mirdwt_2D 15 | load lena512; 16 | x = lena512; 17 | h = daubcqf(6); 18 | [yl,yh,L] = mrdwt(x,h); 19 | assertEqual(L,9); 20 | [x_new,L] = mirdwt(yl,yh,h); 21 | assertEqual(L,9); 22 | assertVectorsAlmostEqual(x, x_new,'relative',0.0001); 23 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/PWMBF/rwt/tests/test_setopt.m: -------------------------------------------------------------------------------- 1 | function test_suite = test_setopt 2 | initTestSuite; 3 | 4 | function test_setopt_all_defaults 5 | x = []; 6 | default_opts = [5 6 7 8]; 7 | z = setopt(x, default_opts); 8 | z_corr = [5 6 7 8]; 9 | assertVectorsAlmostEqual(z, z_corr, 'relative', 0.0001); 10 | 11 | function test_setopt_nonzero_becomes_zero 12 | x = [1 0 3]; 13 | default_opts = [5 6 7 8]; 14 | z = setopt(x, default_opts); 15 | z_corr = [1 6 3 8]; 16 | %z_corr = [1 0 3 8]; % This would be more intuitive 17 | assertVectorsAlmostEqual(z, z_corr, 'relative', 0.0001); 18 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/D_lambda.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/D_lambda.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/D_s.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/D_s.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/ERGAS.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/ERGAS.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/HQNR.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/HQNR.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/Q.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/Q.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/QNR.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/QNR.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/SAM.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/SAM.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/SCC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/SCC.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/mse.m: -------------------------------------------------------------------------------- 1 | function MSE = mse(X) 2 | MSE = sum(X(:).*X(:))/numel(X); -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/norm_blocco.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%% Q2n aux. function 2 | function [y,a,c] = norm_blocco(x) 3 | 4 | a=mean2(x); 5 | c=std2(x); 6 | 7 | if(c==0) 8 | c = eps; 9 | end 10 | 11 | y=((x-a)/c)+1; 12 | 13 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/onion_mult.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%% Q2n aux. function 2 | function ris=onion_mult(onion1,onion2) 3 | 4 | N=length(onion1); 5 | 6 | if N>1 7 | 8 | L=N/2; 9 | 10 | a=onion1(1:L); 11 | b=onion1(L+1:end); 12 | b=[b(1),-b(2:end)]; 13 | c=onion2(1:L); 14 | d=onion2(L+1:end); 15 | d=[d(1),-d(2:end)]; 16 | 17 | 18 | if N==2 19 | ris=[a*c-d*b,a*d+c*b]; 20 | else 21 | ris1=onion_mult(a,c); 22 | ris2=onion_mult(d,[b(1),-b(2:end)]); %% 23 | ris3=onion_mult([a(1),-a(2:end)],d); %% 24 | ris4=onion_mult(c,b); 25 | 26 | aux1=ris1-ris2; 27 | aux2=ris3+ris4; 28 | 29 | ris=[aux1,aux2]; 30 | end 31 | 32 | else 33 | ris = onion1*onion2; 34 | end 35 | 36 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/onion_mult2D.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%% Q2n aux. function 2 | function ris = onion_mult2D(onion1,onion2) 3 | 4 | [~,~,N3]=size(onion1); 5 | 6 | if N3>1 7 | 8 | L=N3/2; 9 | 10 | a=onion1(:,:,1:L); 11 | b=onion1(:,:,L+1:end); 12 | b=cat(3,b(:,:,1),-b(:,:,2:end)); 13 | c=onion2(:,:,1:L); 14 | d=onion2(:,:,L+1:end); 15 | d=cat(3,d(:,:,1),-d(:,:,2:end)); 16 | 17 | 18 | if N3==2 19 | ris=cat(3,a.*c-d.*b,a.*d+c.*b); 20 | else 21 | ris1=onion_mult2D(a,c); 22 | ris2=onion_mult2D(d,cat(3,b(:,:,1),-b(:,:,2:end))); 23 | ris3=onion_mult2D(cat(3,a(:,:,1),-a(:,:,2:end)),d); 24 | ris4=onion_mult2D(c,b); 25 | 26 | aux1=ris1-ris2; 27 | aux2=ris3+ris4; 28 | 29 | ris=cat(3,aux1,aux2); 30 | end 31 | 32 | else 33 | ris = onion1.*onion2; 34 | end 35 | 36 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/psnr_index.m: -------------------------------------------------------------------------------- 1 | function p = psnr_index(x,y) 2 | % psnr - compute the Peack Signal to Noise Ratio, defined by : 3 | p=10*log10(1^2/mse(x-y)); -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/q2n.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Quality_Indices/q2n.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/checkinstall/basicexample.m: -------------------------------------------------------------------------------- 1 | function basicexample() 2 | 3 | % Verify that Manopt was indeed added to the Matlab path. 4 | if isempty(which('spherefactory')) 5 | error(['You should first add Manopt to the Matlab path.\n' ... 6 | 'Please run importmanopt.']); 7 | end 8 | 9 | % Generate the problem data. 10 | n = 1000; 11 | A = randn(n); 12 | A = .5*(A+A'); 13 | 14 | % Create the problem structure. 15 | manifold = spherefactory(n); 16 | problem.M = manifold; 17 | 18 | % Define the problem cost function and its gradient. 19 | problem.cost = @(x) -x'*(A*x); 20 | problem.egrad = @(x) -2*A*x; 21 | problem.ehess = @(x, xdot) -2*A*xdot; 22 | 23 | % Numerically check gradient and Hessian consistency. 24 | figure; 25 | checkgradient(problem); 26 | figure; 27 | checkhessian(problem); 28 | 29 | % Solve. 30 | [x, xcost, info] = trustregions(problem); %#ok 31 | 32 | % Display some statistics. 33 | figure; 34 | semilogy([info.iter], [info.gradnorm], '.-'); 35 | xlabel('Iteration #'); 36 | ylabel('Gradient norm'); 37 | title('Convergence of the trust-regions algorithm on the sphere'); 38 | 39 | end 40 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/importmanopt.m: -------------------------------------------------------------------------------- 1 | % Add Manopt to the path to make all manopt components available. 2 | 3 | % This file is part of Manopt: www.manopt.org. 4 | % Original author: Nicolas Boumal, Jan. 3, 2013. 5 | % Contributors: 6 | % Change log: 7 | % Aug. 7, 2013 (NB): Changed to work without the import command 8 | % (new structure of the toolbox). 9 | % Aug. 8, 2013 (NB): Changed to use addpath_recursive, home brewed. 10 | % Aug. 22, 2013 (NB): Using genpath instead of home cooked 11 | % addpath_recursive. 12 | 13 | addpath(pwd); 14 | 15 | % Recursively add Manopt directories to the Matlab path. 16 | cd manopt; 17 | addpath(genpath(pwd)); 18 | cd ..; 19 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetApproxGradient.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetApproxGradient(problem) 2 | % Checks whether an approximate gradient can be computed for this problem. 3 | % 4 | % function candoit = canGetApproxGradient(problem) 5 | % 6 | % Returns true if an approximate gradient of the cost function is provided 7 | % in the given problem description, false otherwise. 8 | % If a gradient is defined but no approximate gradient is defined 9 | % explicitly, returns false. 10 | % 11 | % Even if this returns false, calls to getApproxGradient may succeed, as 12 | % they will be redirected to getGradientFD. The latter simply requires 13 | % availability of the cost in problem. 14 | % 15 | % See also: canGetGradient getGradientFD 16 | 17 | % This file is part of Manopt: www.manopt.org. 18 | % Original author: Nicolas Boumal, Nov. 1, 2016. 19 | % Contributors: 20 | % Change log: 21 | 22 | candoit = isfield(problem, 'approxgrad'); 23 | 24 | end 25 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetApproxHessian.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetApproxHessian(problem) 2 | % Checks whether an approximate Hessian can be computed for this problem. 3 | % 4 | % function candoit = canGetApproxHessian(problem) 5 | % 6 | % Returns true if an approximate Hessian of the cost function is provided 7 | % in the given problem description, false otherwise. 8 | % If a Hessian is defined but no approximate Hessian is defined explicitly, 9 | % returns false. 10 | % 11 | % Even if this returns false, calls to getApproxHessian may succeed, as 12 | % they will be redirected to getHessianFD. The latter simply requires 13 | % availability of gradients in problem, and vector transports in problem.M. 14 | % 15 | % See also: canGetHessian getHessianFD 16 | 17 | % This file is part of Manopt: www.manopt.org. 18 | % Original author: Nicolas Boumal, April 8, 2015. 19 | % Contributors: 20 | % Change log: 21 | 22 | candoit = isfield(problem, 'approxhess'); 23 | 24 | end 25 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetCost.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetCost(problem) 2 | % Checks whether the cost function can be computed for a problem structure. 3 | % 4 | % function candoit = canGetCost(problem) 5 | % 6 | % Returns true if the cost function can be computed given the problem 7 | % description, false otherwise. 8 | % 9 | % See also: getCost canGetDirectionalDerivative canGetGradient canGetHessian 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, Dec. 30, 2012. 13 | % Contributors: 14 | % Change log: 15 | 16 | 17 | candoit = isfield(problem, 'cost') || isfield(problem, 'costgrad'); 18 | 19 | end 20 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetDirectionalDerivative.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetDirectionalDerivative(problem) 2 | % Checks whether dir. derivatives can be computed for a problem structure. 3 | % 4 | % function candoit = canGetDirectionalDerivative(problem) 5 | % 6 | % Returns true if the directional derivatives of the cost function can be 7 | % computed given the problem description, false otherwise. 8 | % 9 | % See also: canGetCost canGetGradient canGetHessian 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, Dec. 30, 2012. 13 | % Contributors: 14 | % Change log: 15 | 16 | candoit = isfield(problem, 'diff') || canGetGradient(problem); 17 | 18 | end 19 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetEuclideanGradient.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetEuclideanGradient(problem) 2 | % Checks whether the Euclidean gradient can be computed for a problem. 3 | % 4 | % function candoit = canGetEuclideanGradient(problem) 5 | % 6 | % Returns true if the Euclidean gradient can be computed given the problem 7 | % description, false otherwise. 8 | % 9 | % See also: canGetGradient getEuclideanGradient 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, Dec. 30, 2012. 13 | % Contributors: 14 | % Change log: 15 | % 16 | % June 28, 2016 (NB): 17 | % Added support for getPartialEuclideanGradient 18 | 19 | 20 | candoit = isfield(problem, 'egrad') || canGetPartialEuclideanGradient(problem); 21 | 22 | end 23 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetHessian.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetHessian(problem) 2 | % Checks whether the Hessian can be computed for a problem structure. 3 | % 4 | % function candoit = canGetHessian(problem) 5 | % 6 | % Returns true if the Hessian of the cost function can be computed given 7 | % the problem description, false otherwise. 8 | % 9 | % See also: canGetCost canGetDirectionalDerivative canGetGradient 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, Dec. 30, 2012. 13 | % Contributors: 14 | % Change log: 15 | 16 | candoit = isfield(problem, 'hess') || ... 17 | (isfield(problem, 'ehess') && canGetEuclideanGradient(problem)); 18 | 19 | % Display an extra warning message to the user in anticipation of 20 | % common mistakes. 21 | if ~candoit && ... 22 | (isfield(problem, 'ehess') && ~canGetEuclideanGradient(problem)) 23 | warning('manopt:canGetHessian', ... 24 | ['If the Hessian is supplied as a Euclidean Hessian (ehess),\n' ... 25 | 'then the Euclidean gradient must also be supplied (egrad).']); 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetLinesearch.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetLinesearch(problem) 2 | % Checks whether the problem structure can give a line-search a hint. 3 | % 4 | % function candoit = canGetLinesearch(problem) 5 | % 6 | % Returns true if the the problem description includes a mechanism to give 7 | % line-search algorithms a hint as to "how far to look", false otherwise. 8 | % 9 | % See also: getLinesearch 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, July 17, 2014. 13 | % Contributors: 14 | % Change log: 15 | 16 | 17 | candoit = isfield(problem, 'linesearch'); 18 | 19 | end 20 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetPartialEuclideanGradient.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetPartialEuclideanGradient(problem) 2 | % Checks whether the partial Euclidean gradient can be computed for a problem. 3 | % 4 | % function candoit = canGetPartialEuclideanGradient(problem) 5 | % 6 | % Returns true if the partial Euclidean gradient of the cost function can 7 | % be computed given the problem description, false otherwise. 8 | % 9 | % See also: getPartialEuclideanGradient canGetPartialGradient 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, June 28, 2016. 13 | % Contributors: 14 | % Change log: 15 | 16 | candoit = (isfield(problem, 'partialegrad') && isfield(problem, 'ncostterms')); 17 | 18 | if isfield(problem, 'partialegrad') && ~isfield(problem, 'ncostterms') 19 | warning('manopt:partialegrad', ... 20 | ['If problem.partialegrad is specified, indicate the number n\n' ... 21 | 'of terms in the cost function with problem.ncostterms = n.']); 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetPartialGradient.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetPartialGradient(problem) 2 | % Checks whether the partial gradient can be computed for a given problem. 3 | % 4 | % function candoit = canGetPartialGradient(problem) 5 | % 6 | % Returns true if the partial gradient of the cost function can be computed 7 | % given the problem description, false otherwise. 8 | % 9 | % See also: getPartialGradient canGetPartialEuclideanGradient 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, June 28, 2016. 13 | % Contributors: 14 | % Change log: 15 | 16 | candoit = (isfield(problem, 'partialgrad') && isfield(problem, 'ncostterms')) || ... 17 | canGetPartialEuclideanGradient(problem); 18 | 19 | if isfield(problem, 'partialgrad') && ~isfield(problem, 'ncostterms') 20 | warning('manopt:partialgrad', ... 21 | ['If problem.partialgrad is specified, indicate the number n\n' ... 22 | 'of terms in the cost function with problem.ncostterms = n.']); 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetPrecon.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetPrecon(problem) 2 | % Checks whether a preconditioner was specified in the problem description. 3 | % 4 | % function candoit = canGetPrecon(problem) 5 | % 6 | % Returns true if a preconditioner was specified, false otherwise. Notice 7 | % that even if this function returns false, it is still possible to call 8 | % getPrecon, as the default preconditioner is simply the identity operator. 9 | % This check function is mostly useful to tell whether that default 10 | % preconditioner will be in use or not. 11 | % 12 | % See also: getPrecon getSqrtPrecon canGetSqrtPrecon getHessian 13 | 14 | % This file is part of Manopt: www.manopt.org. 15 | % Original author: Nicolas Boumal, July 3, 2013. 16 | % Contributors: 17 | % Change log: 18 | 19 | candoit = isfield(problem, 'precon') || canGetSqrtPrecon(problem); 20 | 21 | end 22 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/canGetSubgradient.m: -------------------------------------------------------------------------------- 1 | function candoit = canGetSubgradient(problem) 2 | % Checks whether a subgradient can be computed for a problem structure. 3 | % 4 | % function candoit = canGetSubgradient(problem) 5 | % 6 | % Returns true if a subgradient of the cost function can be computed given 7 | % the problem description, false otherwise. 8 | % 9 | % See also: canGetGradient 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, July 20, 2017. 13 | % Contributors: 14 | % Change log: 15 | 16 | candoit = isfield(problem, 'subgrad') || canGetGradient(problem); 17 | 18 | end 19 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/getStore.m: -------------------------------------------------------------------------------- 1 | function store = getStore(problem, x, storedb) %#ok 2 | 3 | error('This file was removed from Manopt. Please use the StoreDB class.'); 4 | 5 | end 6 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/mergeOptions.m: -------------------------------------------------------------------------------- 1 | function opts = mergeOptions(opts1, opts2) 2 | % Merges two options structures with one having precedence over the other. 3 | % 4 | % function opts = mergeOptions(opts1, opts2) 5 | % 6 | % input: opts1 and opts2 are two structures. 7 | % output: opts is a structure containing all fields of opts1 and opts2. 8 | % Whenever a field is present in both opts1 and opts2, it is the value in 9 | % opts2 that is kept. 10 | % 11 | % The typical usage is to have opts1 contain default options and opts2 12 | % contain user-specified options that overwrite the defaults. 13 | % 14 | % See also: getGlobalDefaults 15 | 16 | % This file is part of Manopt: www.manopt.org. 17 | % Original author: Nicolas Boumal, Dec. 30, 2012. 18 | % Contributors: 19 | % Change log: 20 | 21 | 22 | if isempty(opts1) 23 | opts1 = struct(); 24 | end 25 | if isempty(opts2) 26 | opts2 = struct(); 27 | end 28 | 29 | opts = opts1; 30 | fields = fieldnames(opts2); 31 | for i = 1 : length(fields) 32 | opts.(fields{i}) = opts2.(fields{i}); 33 | end 34 | 35 | end 36 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/purgeStoredb.m: -------------------------------------------------------------------------------- 1 | function storedb = purgeStoredb(storedb, storedepth) %#ok 2 | 3 | error('This file was removed from Manopt. Please use the StoreDB class.'); 4 | 5 | end 6 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/core/setStore.m: -------------------------------------------------------------------------------- 1 | function storedb = setStore(problem, x, storedb, store) %#ok 2 | 3 | error('This file was removed from Manopt. Please use the StoreDB class.'); 4 | 5 | end 6 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/essential_costE2cost.m: -------------------------------------------------------------------------------- 1 | function val = essential_costE2cost(X, costE) 2 | % Cost evaluation at X given function handle in the Essential matrix E. 3 | % 4 | % function val = essential_costE2cost(X, costE) 5 | % 6 | % costE is the function handle for the cost function in E. 7 | % 8 | % See also: essential_egradE2egrad essential_ehessE2ehess 9 | 10 | % This file is part of Manopt: www.manopt.org. 11 | % Original author: Roberto Tron, Aug. 8, 2014 12 | % Contributors: Bamdev Mishra, May 22, 2015. 13 | 14 | e3hat = [0 -1 0; 1 0 0; 0 0 0]; 15 | 16 | RA = X(:,1:3,:); 17 | RB = X(:,4:6,:); 18 | E = multiprod(multiprod(multitransp(RA), e3hat), RB); 19 | 20 | val = costE(E); 21 | end 22 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/essential_egradE2egrad.m: -------------------------------------------------------------------------------- 1 | function egrad = essential_egradE2egrad(X, egradE) 2 | % Converts the gradient in essential matrix E to the gradient in X. 3 | % 4 | % function egrad = essential_egradE2egrad(X, egradE) 5 | % 6 | % egradE is the function handle for the gradient in E. 7 | % 8 | % The output is a matrix in the space of X. 9 | % 10 | % See also: essential_costE2cost essential_ehessE2ehess 11 | 12 | 13 | % This file is part of Manopt: www.manopt.org. 14 | % Original author: Roberto Tron, Aug. 8, 2014 15 | % Contributors: Bamdev Mishra, May 22, 2015. 16 | 17 | e3hat = [0 -1 0; 1 0 0; 0 0 0]; 18 | RA = X(:,1:3,:); 19 | RB = X(:,4:6,:); 20 | E = multiprod(multiprod(multitransp(RA), e3hat), RB); 21 | G = egradE(E); 22 | 23 | %The following is the vectorized version of egrad = e3hat*[RB*G' -RA*G]; 24 | egrad = multiprod(e3hat, cat(2,... 25 | multiprod(RB, multitransp(G)),... 26 | -multiprod(RA, G))); 27 | end 28 | 29 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/essential_flat.m: -------------------------------------------------------------------------------- 1 | function Hp = essential_flat(H) 2 | %Reshape a [3x6xk] matrix to a [3x3x2k] matrix 3 | Hp = reshape(H,3,3,[]); 4 | end 5 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/essential_hat3.m: -------------------------------------------------------------------------------- 1 | %Compute the matrix representation of the cross product 2 | %function [V,vShift] = essential_hat3(v) 3 | %V is a [3x3xN] array of skew-symmetric matrices where each [3x3] block is 4 | %the matrix representation of the cross product of one of the columns of v 5 | %vShift is equal to permute(v,[1 3 2]). 6 | function [V, vShift] = essential_hat3(v) 7 | N = size(v,2); 8 | V = zeros(3,3,N); 9 | vShift = permute(v,[1 3 2]); 10 | V(1,2,:) = -vShift(3,:,:); 11 | V(2,1,:) = vShift(3,:,:); 12 | V(1,3,:) = vShift(2,:,:); 13 | V(3,1,:) = -vShift(2,:,:); 14 | V(2,3,:) = -vShift(1,:,:); 15 | V(3,2,:) = vShift(1,:,:); 16 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/essential_sharp.m: -------------------------------------------------------------------------------- 1 | function H = essential_sharp(Hp) 2 | %Reshape a [3x3x2k] matrix to a [3x6xk] matrix 3 | H = reshape(Hp,3,6,[]); 4 | end 5 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/privateessential/essential_closestRepresentative.m: -------------------------------------------------------------------------------- 1 | function Q2r=essential_closestRepresentative(Q1,Q2,varargin) 2 | [tMin,~,Q2]=essential_distMinAngle(Q1,Q2,varargin{:}); 3 | NQ1=size(Q1,3); 4 | NQ2=size(Q2,3); 5 | 6 | if NQ1>1 && NQ2==1 7 | Q2=repmat(Q2,[1 1 NQ1]); 8 | end 9 | NQ=max(NQ1,NQ2); 10 | 11 | Q2r=zeros(size(Q2)); 12 | for iQ=1:NQ 13 | t=tMin(iQ); 14 | Rz=[cos(t) -sin(t) 0; sin(t) cos(t) 0; 0 0 1]; 15 | Q2r(1:3,1:3,iQ)=Rz*Q2(1:3,1:3,iQ); 16 | Q2r(4:6,1:3,iQ)=Rz*Q2(4:6,1:3,iQ); 17 | end 18 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/privateessential/essential_distMinAnglePair.m: -------------------------------------------------------------------------------- 1 | function [tMin,fMin,tBreak1,tBreak2,Q2,tMinAll]=essential_distMinAnglePair(Q1,Q2,kFlip) 2 | 3 | switch kFlip 4 | case 1 5 | %nothing to do 6 | case 2 7 | Q2([2 3 4 6],:)=-Q2([2 3 4 6],:); 8 | case 3 9 | Q2([4 5],:)=-Q2([4 5],:); 10 | case 4 11 | Q2([2 3 5 6],:)=-Q2([2 3 5 6],:); 12 | otherwise 13 | error('Value of kFlip invalid') 14 | end 15 | 16 | Q11=Q1(1:3,:); 17 | Q12=Q1(4:6,:); 18 | Q21=Q2(1:3,:); 19 | Q22=Q2(4:6,:); 20 | 21 | Q211=Q21*Q11'; 22 | Q212=Q22*Q12'; 23 | [tMin,fMin,tBreak1,tBreak2,tMinAll]=essential_distMinAnglePair_base(Q211,Q212); 24 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/privateessential/essential_distMinAnglePair_computeDfBreak.m: -------------------------------------------------------------------------------- 1 | function dfBreak=essential_distMinAnglePair_computeDfBreak(tBreak,Q21) 2 | c=cos(tBreak); 3 | s=sin(tBreak); 4 | 5 | % The code below is an optimization exploiting the structure of RBreak to 6 | % substitute the following code 7 | % RBreak=Q1'*[c -s 0; s c 0; 0 0 1]*Q2; 8 | % 9 | % %compute v0 such that RBreak=rot(pi*v0) 10 | % [U,~,~]=svd(RBreak+eye(3)); 11 | % v0=U(:,1); 12 | % 13 | % dfBreak=pi*abs(Q1(3,:)*v0); 14 | 15 | Q1RBreakQ1=[c -s 0; s c 0; 0 0 1]*Q21; 16 | [U,~,~]=svd(Q1RBreakQ1+eye(3)); 17 | dfBreak=pi*abs(U(3,1)); 18 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/privateessential/essential_distMinAnglePair_discontinuityDistance.m: -------------------------------------------------------------------------------- 1 | function [tBreak,a,b,c,m,p]=essential_distMinAnglePair_discontinuityDistance(Q21) 2 | a=Q21(1,1)+Q21(2,2); 3 | b=Q21(1,2)-Q21(2,1); 4 | c=Q21(3,3); 5 | 6 | m=norm([a;b]); 7 | p=sign(a)*acos(clip(b/m)); 8 | 9 | %tBreak=modAngle(3/2*pi-p); 10 | tBreak=-0.5*pi-p; 11 | 12 | function v=clip(v) 13 | v=min(1,max(-1,v)); 14 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/privateessential/essential_distMinAnglePair_ft.m: -------------------------------------------------------------------------------- 1 | %Evaluate cost function for closest representative search given coefficients 2 | %function ft=essential_distMinAnglePair_ft(t,m1,p1,c1,m2,p2,c2) 3 | %Evaluates the cost function used by essential_distMinAnglePair to find the 4 | %closest representative in the equivalence class of a QREM 5 | %If m2,p2,c2 are omitted or empty, get value of a single term 6 | function ft=essential_distMinAnglePair_ft(t,m1,p1,c1,m2,p2,c2) 7 | flagSingleTerm=false; 8 | if ~exist('m2','var') || isempty(m2) 9 | flagSingleTerm=true; 10 | end 11 | 12 | if flagSingleTerm 13 | ft=acos((m1*sin(t+p1)+c1-1)/2)^2; 14 | else 15 | ft=acos((m1*sin(t+p1)+c1-1)/2)^2+acos((m2*sin(t+p2)+c2-1)/2)^2; 16 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/privateessential/essential_distMinAnglePair_test.m: -------------------------------------------------------------------------------- 1 | function essential_distMinAnglePair_test 2 | resetRands(3) 3 | flagDegenerateCase=true; 4 | k=2; 5 | 6 | e3=[0;0;1]; 7 | Q1=rot_randn([],[],2); 8 | if flagDegenerateCase 9 | Q1b=[Q1(:,:,1);Q1(:,:,2)]; 10 | Q2b=essential_randomVerticalMotion(Q1b); 11 | Q2=cat(3,Q2b(1:3,:),Q2b(4:6,:)); 12 | else 13 | Q2=rot_randn([],[],2); 14 | end 15 | Rzt=@(t) rot(t*e3); 16 | 17 | Q21tk=@(t,k) Rzt(t)*essential_flipAmbiguity_R1(Q2(:,:,1),k); 18 | Q22tk=@(t,k) Rzt(t)*essential_flipAmbiguity_R2(Q2(:,:,2),k); 19 | 20 | figure(1) 21 | [tMin,fMin,tBreak1,tBreak2,Q2Flip]=essential_distMinAnglePair([Q1(:,:,1);Q1(:,:,2)],[Q2(:,:,1);Q2(:,:,2)],k); 22 | tMin=modAngle(tMin); 23 | ft=@(t) (rot_dist(Q1(:,:,1),Q21tk(t,k))^2+rot_dist(Q1(:,:,2),Q22tk(t,k))^2); 24 | dft=@(t) 2*e3'*(Q1(:,:,1)*logrot(Q1(:,:,1)'*Q21tk(t,k))+Q1(:,:,2)*logrot(Q1(:,:,2)'*Q22tk(t,k))); 25 | check_der(ft,dft,'angle') 26 | hold on 27 | plot(tBreak1,ft(tBreak1),'r+') 28 | plot(tBreak2,ft(tBreak2),'g+') 29 | 30 | plot(tMin,fMin,'kx','MarkerSize',20) 31 | 32 | hold off 33 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/essential/privateessential/modAngle.m: -------------------------------------------------------------------------------- 1 | %Maps any angle to the equivalent between -pi and pi 2 | function a=modAngle(a) 3 | a=mod(a+pi,2*pi)-pi; 4 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/sphere/spherefactory.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/manifolds/sphere/spherefactory.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/dexpm.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/dexpm.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/dfunm.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/dfunm.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/dlogm.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/dlogm.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/dsqrtm.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/dsqrtm.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/matrixlincomb.m: -------------------------------------------------------------------------------- 1 | function v = matrixlincomb(x, a1, d1, a2, d2) %#ok 2 | % Linear combination function for tangent vectors represented as matrices. 3 | % 4 | % function v = lincomb(x, a1, d1) 5 | % function v = lincomb(x, a1, d1, a2, d2) 6 | % 7 | % Given a point x, two tangent vectors d1 and d2 at x, and two real 8 | % coefficients a1 and a2, returns a tangent vector at x representing 9 | % a1*d1 + a2*d2, if d1 and d2 are represented as matrices (or more 10 | % generally as arrays in Matlab). 11 | % 12 | % If a2 and d2 are omitted, the returned tangent vector is a1*d1. 13 | % 14 | % The input x is actually unused. 15 | % 16 | % This function is a helper to define manifolds in Manopt. 17 | 18 | % This file is part of Manopt: www.manopt.org. 19 | % Original author: Nicolas Boumal, July 2, 2015. 20 | % Contributors: 21 | % Change log: 22 | 23 | if nargin == 3 24 | v = a1*d1; 25 | elseif nargin == 5 26 | v = a1*d1 + a2*d2; 27 | else 28 | error('matrixlincomb takes either 3 or 5 inputs.'); 29 | end 30 | 31 | end 32 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/multiherm.m: -------------------------------------------------------------------------------- 1 | function Y = multiherm(X) 2 | % Returns the Hermitian parts of the matrices in the 3D matrix X 3 | % 4 | % function Y = multiherm(X) 5 | % 6 | % Y is a 3D matrix the same size as X. Each slice Y(:, :, i) is the 7 | % Hermitian part of the slice X(:, :, i). 8 | % 9 | % See also: multiprod multitransp multihconj multiscale multiskew 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Hiroyuki Sato, April 27, 2015. 13 | % Contributors: 14 | % Change log: 15 | 16 | Y = .5*(X + multihconj(X)); 17 | 18 | end 19 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/multiprod.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/multiprod.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/multiscale.m: -------------------------------------------------------------------------------- 1 | function A = multiscale(scale, A) 2 | % Multiplies the 2D slices in a 3D matrix by individual scalars. 3 | % 4 | % function A = multiscale(scale, A) 5 | % 6 | % Given a vector scale of length N and a 3-dimensional matrix A of size 7 | % n-by-m-by-N, returns a matrix A of same size such that 8 | % A(:, :, k) := scale(k) * A(:, :, k); 9 | % 10 | % See also: multiprod multitransp multitrace 11 | 12 | % This file is part of Manopt: www.manopt.org. 13 | % Original author: Nicolas Boumal, Dec. 30, 2012. 14 | % Contributors: 15 | % Change log: 16 | 17 | 18 | assert(ndims(A) <= 3, ... 19 | ['multiscale is only well defined for matrix arrays of 3 ' ... 20 | 'or less dimensions.']); 21 | [n, m, N] = size(A); 22 | assert(numel(scale) == N, ... 23 | ['scale must be a vector whose length equals the third ' ... 24 | 'dimension of A, that is, the number of 2D matrix slices ' ... 25 | 'in the 3D matrix A.']); 26 | 27 | scale = scale(:); 28 | A = reshape(bsxfun(@times, reshape(A, n*m, N), scale'), n, m, N); 29 | 30 | end 31 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/multiskew.m: -------------------------------------------------------------------------------- 1 | function Y = multiskew(X) 2 | % Returns the skew-symmetric parts of the matrices in the 3D matrix X. 3 | % 4 | % function Y = multiskew(X) 5 | % 6 | % Y is a 3D matrix the same size as X. Each slice Y(:, :, i) is the 7 | % skew-symmetric part of the slice X(:, :, i). 8 | % 9 | % See also: multiprod multitransp multiscale multisym 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, Jan. 31, 2013. 13 | % Contributors: 14 | % Change log: 15 | 16 | Y = .5*(X - multitransp(X)); 17 | 18 | end 19 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/multisqnorm.m: -------------------------------------------------------------------------------- 1 | function sqnorm = multisqnorm(A) 2 | % Returns the squared Frobenius norms of the slices of a 3D matrix. 3 | % 4 | % function sqnorm = multisqnorm(A) 5 | % 6 | % Given a 3-dimensional matrix A of size n-by-m-by-N, returns a column 7 | % vector of length N such that sqnorm(i) = norm(A(:, :, i), 'fro')^2. 8 | % 9 | % See also: multiprod multitransp multitrace norms 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, June 17, 2015. 13 | % Contributors: 14 | % Change log: 15 | 16 | 17 | assert(ndims(A) <= 3, ... 18 | ['multisqnorm is only well defined for matrix arrays of 3 ' ... 19 | 'or less dimensions.']); 20 | [n, m, N] = size(A); 21 | 22 | % This is equivalent to squeeze(sum(norms(A, 2, 1).^2)), but faster. 23 | sqnorm = sum(reshape(A, n*m, N).^2, 1)'; 24 | 25 | end 26 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/multisym.m: -------------------------------------------------------------------------------- 1 | function Y = multisym(X) 2 | % Returns the symmetric parts of the matrices in the 3D matrix X 3 | % 4 | % function Y = multisym(X) 5 | % 6 | % Y is a 3D matrix the same size as X. Each slice Y(:, :, i) is the 7 | % symmetric part of the slice X(:, :, i). 8 | % 9 | % See also: multiprod multitransp multiscale multiskew 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, Jan. 31, 2013. 13 | % Contributors: 14 | % Change log: 15 | 16 | Y = .5*(X + multitransp(X)); 17 | 18 | end 19 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt/tools/multitrace.m: -------------------------------------------------------------------------------- 1 | function tr = multitrace(A) 2 | % Computes the traces of the 2D slices in a 3D matrix. 3 | % 4 | % function tr = multitrace(A) 5 | % 6 | % For a 3-dimensional matrix A of size n-by-n-by-N, returns a column vector 7 | % tr of length N such that tr(k) = trace(A(:, :, k)); 8 | % 9 | % See also: multiprod multitransp multiscale 10 | 11 | % This file is part of Manopt: www.manopt.org. 12 | % Original author: Nicolas Boumal, Dec. 30, 2012. 13 | % Contributors: 14 | % Change log: 15 | 16 | 17 | assert(ndims(A) <= 3, ... 18 | ['multitrace is only well defined for matrix arrays of 3 ' ... 19 | 'or less dimensions.']); 20 | 21 | tr = diagsum(A, 1, 2); 22 | 23 | end 24 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/RR/manopt/manopt_version.m: -------------------------------------------------------------------------------- 1 | function [version, released] = manopt_version() 2 | % Returns the version of the Manopt package you are running, as a vector. 3 | % 4 | % function [version, released] = manopt_version() 5 | % 6 | % version(1) is the primary version number. 7 | % released is the date this version was released, in the same format as the 8 | % date() function in Matlab. 9 | 10 | version = [4, 0, 0]; 11 | released = '09-Sep-2017'; 12 | 13 | end 14 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/TV/TV_pansharpen.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/TV/TV_pansharpen.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/LPfilter.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/LPfilter.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/LPfilterGauss.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/LPfilterGauss.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/LPfilterPlusDec.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/LPfilterPlusDec.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/MTF.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/MTF.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/MTF_PAN.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/MTF_PAN.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/estimation_alpha.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/estimation_alpha.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/genMTF.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/genMTF.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/gen_LP_image.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/gen_LP_image.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/indexes_evaluation.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/indexes_evaluation.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/interp23tap.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/interp23tap.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/k_means_clustering.m: -------------------------------------------------------------------------------- 1 | % I_MS: Image to segment 2 | % n_segm: Number of segments 3 | % Output: 4 | % S: Segmentation map. 5 | function S = k_means_clustering(I_MS, n_segm) 6 | 7 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+ 8 | %%% k-means Segmentation of MS image 9 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+ 10 | 11 | F1 = zeros(size(I_MS,1)*size(I_MS,2),size(I_MS,3)); 12 | 13 | for ibands = 1 :size(I_MS,3) 14 | a = I_MS(:,:,ibands); 15 | F1(:,ibands) = a(:)/max(a(:)); 16 | end 17 | IDX = kmeans(F1,n_segm); 18 | S = reshape(IDX,[size(I_MS,1) size(I_MS,2)]); 19 | 20 | end 21 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/printImage.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Description: 3 | % Print EPS image. 4 | % 5 | % Interface: 6 | % printImage(I_MS,title) 7 | % 8 | % Inputs: 9 | % I_MS: Image to print; 10 | % title: Filename. 11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12 | function printImage(I_MS,title) 13 | 14 | figure,imshow(I_MS,'Border','tight','InitialMagnification',100); 15 | print(sprintf(title,'.eps'),'-depsc2','-r300'); 16 | % print(sprintf(title,'.png'),'-dpng','-r400'); 17 | 18 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/rectangleonimage.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/rectangleonimage.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/resize_images.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/resize_images.m -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/Tools/showPan.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Description: 3 | % Visualize and print the panchromatic image. 4 | % 5 | % Interface: 6 | % showPan(Pan,print,id,flag_cut_bounds,dim_cut) 7 | % 8 | % Inputs: 9 | % Pan: Panchromatic image; 10 | % print: Flag. If print == 1, print EPS image; 11 | % id: Identifier (name) of the printed EPS image; 12 | % flag_cut_bounds: Cut the boundaries of the viewed Panchromatic image; 13 | % dim_cut: Define the dimension of the boundary cut; 14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 | function IN = showPan(Pan,print,id,flag_cut_bounds,dim_cut) 16 | 17 | if flag_cut_bounds 18 | Pan = Pan(dim_cut:end-dim_cut,dim_cut:end-dim_cut,:); 19 | end 20 | 21 | IN = viewimage(Pan); 22 | 23 | if print 24 | printImage(IN,sprintf('Outputs/%d.eps',id)); 25 | end 26 | 27 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/analysis_unref_batched_images.asv: -------------------------------------------------------------------------------- 1 | function res = analysis_unref_batched_images(sr, ms, lms, pan, ratio, sensor) 2 | addpath('./Quality_Indices/') 3 | sz = size(sr); 4 | bs = sz(1); 5 | d_lambdas = []; 6 | qnr_indices = []; 7 | d_ses = []; 8 | blockSize = 32; 9 | res = {}; 10 | for i = (1: bs) 11 | sr1 = permute(squeeze(sr(i, :, :, :)), [2, 3, 1]); 12 | ms1 = permute(squeeze(ms(i, :, :, :)), [2, 3, 1]); 13 | lms1 = permute(squeeze(lms(i, :, :, :)), [2, 3, 1]); 14 | pan1 = permute(pan(i, :, :, :)) 15 | [d_lambdas(i), d_ses(i), qnr_indices(i)] = indexes_evaluation_FS(sr1, lms1, pan1, 11, 0, ms1, sensor, ratio, 0); 16 | end 17 | res.d_lambda = [mean(d_lambdas), std(d_lambdas)]; 18 | res.qnr_index = [mean(qnr_indices), std(qnr_indices)]; 19 | res.d_s = [mean(d_ses), std(d_ses)]; 20 | end -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/nohup.out: -------------------------------------------------------------------------------- 1 | sh: 0: Can't open ./run.sh 2 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/quality_assess.m: -------------------------------------------------------------------------------- 1 | function [mean_psnr, mean_ssim] = quality_assess(imagery1, imagery2) 2 | %========================================================================== 3 | % Evaluates the quality assessment indices for two tensors. 4 | % 5 | % Syntax: 6 | % [mpsnr, mssim] = quality_access(imagery1, imagery2) 7 | % 8 | % Input: 9 | % imagery1 - the reference tensor 10 | % imagery2 - the target tensor 11 | 12 | % NOTE: the tensor is a I1*I2*...*IN array and DYNAMIC RANGE [0, 255]. 13 | % Output: 14 | % mpsnr - Peak Signal-to-Noise Ratio 15 | % mssim - Structure SIMilarity 16 | %========================================================================== 17 | Nway = size(imagery1); 18 | if length(Nway)>3 19 | imagery1 = reshape(imagery1,Nway(1),Nway(2),[]); 20 | imagery2 = reshape(imagery2,Nway(1),Nway(2),[]); 21 | end 22 | psnr = zeros(prod(Nway(3:end)),1); 23 | ssim = psnr; 24 | for ii = 1:prod(Nway(3:end)) 25 | psnr(ii) = psnr_index(imagery1(:, :, ii), imagery2(:, :, ii)); 26 | % 因为ssim_index是邓尚琦给的代码,需要乘255 27 | ssim(ii) = ssim_index(imagery1(:, :, ii)*255, imagery2(:, :, ii)*255); 28 | end 29 | mean_psnr = mean(psnr); 30 | mean_ssim = mean(ssim); 31 | %out = [mean(psnr), mean(ssim)]; 32 | 33 | -------------------------------------------------------------------------------- /Pansharpening_Hyper_SR_Matlab_Test_Package/read_h5_data.m: -------------------------------------------------------------------------------- 1 | function [ms, lms, pan, sr, gt] = read_h5_data(path) 2 | ms = h5read(path, '/ms'); 3 | lms = h5read(path, '/lms'); 4 | pan = h5read(path, '/pan'); 5 | sr = h5read(path, '/sr'); 6 | gt = h5read(path, '/gt'); 7 | 8 | ms = permute(ms, [4, 3, 1, 2]); 9 | lms = permute(lms, [4, 3, 1, 2]); 10 | pan = permute(pan, [4, 3, 1, 2]); 11 | sr = permute(sr, [4, 3, 1, 2]); 12 | gt = permute(gt, [4, 3, 1, 2]); 13 | end -------------------------------------------------------------------------------- /configs/FeINFN_config.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | name: 'adamw' 3 | lr: !!float 2e-4 4 | weight_decay: 0.0 5 | 6 | lr_scheduler: 7 | name: 'cos_anneal' 8 | T_max: 300 9 | eta_min: !!float 1e-5 10 | 11 | max_norm: 1e-4 12 | 13 | path: 14 | cave_x4_train_path: /train_data/ 15 | cave_x4_val_path: /val_data/ 16 | 17 | harvard_x4_train_path: /train_data/ 18 | harvard_x4_val_path: /val_data/ 19 | 20 | cave_x8_train_path: /train_data/ 21 | cave_x8_val_path: /val_data/ 22 | 23 | harvard_x8_train_path: /train_data/ 24 | harvard_x8_val_path: /val_data/ 25 | 26 | network_configs: 27 | FeINFN: 28 | hsi_dim: 31 #128 #31 #102 29 | msi_dim: 3 #3 #1 30 | NIR_dim: 33 #130 #33 #104 31 | feat_dim: 128 32 | guide_dim: 128 33 | spa_edsr_num: 4 34 | spe_edsr_num: 4 35 | mlp_dim: [256, 128] 36 | d_model: 2 37 | scale: 4 38 | patch_merge: no 39 | 40 | logger_config: 41 | base_path: ./log_file/ 42 | name: FeINFN 43 | file_mode: w 44 | -------------------------------------------------------------------------------- /configs/dcfnet_config.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | name: 'adamw' 3 | lr: !!float 1e-3 4 | weight_decay: !!float 1e-6 5 | 6 | lr_scheduler: 7 | name: 'multi_step' 8 | milestones: [100, 1000] 9 | gamma: 0.1 10 | # name: 'identity' 11 | 12 | max_norm: 0.3 13 | 14 | path: 15 | # train_path: '/home/ZiHanCao/datasets/pansharpening/wv3/training_wv3/train_wv3.h5' 16 | # val_path: '/home/ZiHanCao/datasets/pansharpening/wv3/training_wv3/valid_wv3.h5' 17 | # train_path: "/home/ZiHanCao/datasets/HISI/new_cave/train_cave(with_up)x4.h5" 18 | # val_path: "/home/ShangqiDeng/data/HSI/cave_x4/test_cavepatches64-2.h5" 19 | train_path: "/Data2/ZiHanCao/datasets/HISI/new_cave/train_cave(with_up)x4.h5" 20 | val_path: "/Data2/ZiHanCao/datasets/HISI/new_cave/test_cave(with_up)x4.h5" 21 | # train_path: '/home/ZiHanCao/datasets/pansharpening/qb/training_qb/train_qb.h5' 22 | # val_path: '/home/ZiHanCao/datasets/pansharpening/qb/training_qb/valid_qb.h5' 23 | # train_path: '/home/ZiHanCao/datasets/pansharpening/gf/training_gf2/train_gf2.h5' 24 | # val_path: '/home/ZiHanCao/datasets/pansharpening/gf/training_gf2/valid_gf2.h5' 25 | 26 | network_configs: 27 | spectral_num: 31 28 | mode: 'C' 29 | 30 | 31 | logger_config: 32 | base_path: ./log_file/ 33 | name: dcfnet 34 | file_mode: w -------------------------------------------------------------------------------- /configs/hsrnet_config.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | name: "adamw" 3 | lr: !!float 1e-3 4 | weight_decay: !!float 1e-6 5 | 6 | lr_scheduler: 7 | name: "multi_step" 8 | milestones: [400, 800] 9 | gamma: 0.1 10 | 11 | max_norm: 0.01 12 | 13 | path: 14 | # train_path: '/Data2/DataSet/HISR/CAVE/train_cave(with_up)x4.h5' 15 | # val_path: '/Data2/DataSet/HISR/CAVE/validation_cave(with_up)x4.h5' 16 | train_path: "/Data2/ZiHanCao/datasets/pansharpening/GF5_GF1/train_GF5_GF1.h5" 17 | val_path: "/Data2/Datasets/GF5_GF1/test_GF5_GF1-new.h5" 18 | 19 | # train_path: '/home/ZiHanCao/datasets/HISI/new_cave/train_cave(with_up)x4.h5' 20 | # val_path: '/home/ZiHanCao/datasets/HISI/new_cave/validation_cave(with_up)x4.h5' 21 | # train_path: '/home/ZiHanCao/datasets/HISI/new_harvard/train_harvard(with_up)x4_rgb.h5' 22 | # val_path: '/home/ZiHanCao/datasets/HISI/new_harvard/validation_harvard(with_up)x4_rgb.h5' 23 | 24 | network_configs: 25 | spectral_num: 150 26 | rgb_num: 4 27 | scale: 2 28 | 29 | logger_config: 30 | base_path: ./log_file/ 31 | name: ssrnet_gf5 32 | file_mode: w 33 | -------------------------------------------------------------------------------- /configs/huggingface/accelerate.yaml: -------------------------------------------------------------------------------- 1 | compute_environment: LOCAL_MACHINE 2 | deepspeed_config: 3 | deepspeed_config_file: configs/huggingface/deepspeed_ZERO2_bf16_config.json 4 | # zero3_init_flag: false 5 | # gradient_accumulation_steps: 2 6 | # gradient_clipping: 1.0 7 | # offload_optimizer_device: none 8 | # offload_param_device: none 9 | # zero_stage: 0 10 | distributed_type: NO # DEEPSPEED # MULTI_GPU 11 | fsdp_config: {} 12 | machine_rank: null 13 | main_process_ip: null 14 | main_process_port: null 15 | main_training_function: main 16 | # mixed_precision: bf16 # fp16 17 | num_machines: 1 18 | num_processes: 1 19 | use_cpu: false -------------------------------------------------------------------------------- /configs/huggingface/accelerate_fsdp_config.yaml: -------------------------------------------------------------------------------- 1 | compute_environment: LOCAL_MACHINE 2 | debug: false 3 | distributed_type: FSDP 4 | downcast_bf16: 'no' 5 | enable_cpu_affinity: false 6 | fsdp_config: 7 | fsdp_activation_checkpointing: true 8 | fsdp_auto_wrap_policy: SIZE_BASED_WRAP 9 | fsdp_backward_prefetch: BACKWARD_PRE 10 | fsdp_cpu_ram_efficient_loading: false 11 | fsdp_forward_prefetch: true 12 | fsdp_min_num_params: 100000000 13 | fsdp_offload_params: true 14 | fsdp_sharding_strategy: SHARD_GRAD_OP 15 | fsdp_state_dict_type: FULL_STATE_DICT 16 | fsdp_sync_module_states: true 17 | fsdp_use_orig_params: true 18 | machine_rank: 0 19 | main_training_function: main 20 | mixed_precision: 'no' 21 | num_machines: 1 22 | num_processes: 2 23 | rdzv_backend: static 24 | same_network: true 25 | tpu_env: [] 26 | tpu_use_cluster: false 27 | tpu_use_sudo: false 28 | use_cpu: false 29 | -------------------------------------------------------------------------------- /configs/huggingface/deepspeed_ZERO2_bf16_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "bf16":{ 3 | "enabled": false 4 | }, 5 | "zero_optimization": { 6 | "stage": 2, 7 | "allgather_partitions": true, 8 | "allgather_bucket_size": 2e8, 9 | "overlap_comm": true, 10 | "reduce_scatter": true, 11 | "reduce_bucket_size": 1e8, 12 | "contiguous_gradients": true 13 | }, 14 | "gradient_accumulation_steps": 2, 15 | "gradient_clipping": "auto", 16 | "steps_per_print": 2000, 17 | "train_batch_size": "auto", 18 | "train_micro_batch_size_per_gpu": "auto", 19 | "wall_clock_breakdown": false 20 | } -------------------------------------------------------------------------------- /configs/huggingface/deepspeed_ZERO2_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "fp16": { 3 | "enabled": false, 4 | "loss_scale": 0, 5 | "loss_scale_window": 1000, 6 | "initial_scale_power": 16, 7 | "hysteresis": 2, 8 | "min_loss_scale": 1 9 | }, 10 | "zero_optimization": { 11 | "stage": 2, 12 | "allgather_partitions": true, 13 | "allgather_bucket_size": 3e8, 14 | "overlap_comm": true, 15 | "reduce_scatter": true, 16 | "reduce_bucket_size": 3e8, 17 | "contiguous_gradients": true 18 | }, 19 | "gradient_accumulation_steps": 1, 20 | "gradient_clipping": "auto", 21 | "steps_per_print": 2000, 22 | "train_batch_size": "auto", 23 | "train_micro_batch_size_per_gpu": "auto", 24 | "wall_clock_breakdown": false 25 | } -------------------------------------------------------------------------------- /configs/hypertransformer_config.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | name: 'adam' 3 | lr: !!float 1e-4 4 | weight_decay: !!float 1e-4 5 | 6 | max_norm: 0.003 7 | 8 | lr_scheduler: 9 | name: 'identity' 10 | 11 | path: 12 | train_path: '/home/ZiHanCao/datasets/HISI/new_cave/train_cave(with_up)x4.h5' 13 | val_path: '/home/ZiHanCao/datasets/HISI/new_cave/validation_cave(with_up)x4.h5' 14 | 15 | network_configs: 16 | in_c: 31 17 | out_c: 31 18 | rgb_c: 3 19 | factor: 4 20 | is_dhp_ms: no 21 | lr_size: 16 22 | feature_sum: no -------------------------------------------------------------------------------- /configs/hypertransformer_pre_config.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | name: 'adamw' 3 | lr: !!float 1e-3 4 | weight_decay: !!float 1e-4 5 | 6 | max_norm: 0.003 7 | 8 | lr_scheduler: 9 | name: 'multi_step' 10 | milestones: [300] 11 | gamma: 0.1 12 | # name: 'identity' 13 | 14 | path: 15 | train_path: '/Data3/cao/cavex4/test_cavepatches128-2.h5' 16 | val_path: '/Data3/cao/ZiHanCao/datasets/HISI/new_cave/test_cave(with_up)x4.h5' 17 | 18 | # train_path: "/media/office-401/Elements SE/cao/ZiHanCao/datasets/HISI/data_Pavia/Train_Pavia.h5" 19 | # val_path: "/media/office-401/Elements SE/cao/ZiHanCao/datasets/HISI/data_Pavia/Test_Pavia.h5" 20 | 21 | # train_path: "/media/office-401/Elements SE/cao/ZiHanCao/datasets/HISI/data_Botswana/Train_Botswana.h5" 22 | # val_path: "/media/office-401/Elements SE/cao/ZiHanCao/datasets/HISI/data_Botswana/Test_Botswana.h5" 23 | 24 | network_configs: 25 | config: none 26 | # in_c: 31 27 | # out_c: 31 28 | # rgb_c: 3 29 | # factor: 4 30 | # is_dhp_ms: no 31 | # lr_size: 16 32 | # feature_sum: no 33 | 34 | logger_config: 35 | name: 'hypertransformer_pre' 36 | base_path: './log_file/' 37 | file_mode: 'w' -------------------------------------------------------------------------------- /configs/lformer_config.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | name: "adamw" 3 | lr: !!float 3e-4 4 | weight_decay: !!float 1e-6 5 | 6 | lr_scheduler: 7 | name: 'cos_anneal_restart_reduce' 8 | T_0: 100 9 | T_mult: 2 10 | lr_mult: 0.5 11 | eta_min: !!float 1e-6 12 | 13 | max_norm: 0.03 14 | ema_decay: 0.999 15 | 16 | path: 17 | wv3_train_path: /train_data/ 18 | wv3_val_path: /val_data/ 19 | 20 | gf2_train_path: /train_data/ 21 | gf2_val_path: /val_data/ 22 | 23 | cave_x4_train_path: /train_data/ 24 | cave_x4_val_path: /val_data/ 25 | 26 | network_configs: 27 | lformer: 28 | pan_dim: 1 29 | lms_dim: 4 30 | attn_dim: 64 31 | hp_dim: 64 32 | n_stage: 5 33 | patch_merge: yes 34 | crop_batch_size: 64 35 | patch_size_list: [16, 64, 64] 36 | scale: 4 37 | 38 | logger_config: 39 | base_path: ./log_file/ 40 | name: lformer 41 | file_mode: w 42 | -------------------------------------------------------------------------------- /configs/m3dnet_config.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | name: 'adam' 3 | lr: !!float 1e-3 4 | weight_decay: !!float 1e-6 5 | 6 | lr_scheduler: 7 | name: 'multi_step' 8 | milestones: [ 100, 250, 400, 600, 800, 1000 ] 9 | gamma: 0.5 10 | 11 | max_norm: 0.01 12 | 13 | path: 14 | train_path: '/Data2/DataSet/pansharpening/training_data/train_wv3.h5' 15 | val_path: '/Data2/DataSet/pansharpening/training_data/valid_wv3.h5' 16 | 17 | network_configs: 18 | ms_channels: 8 19 | pan_channel: 1 20 | n_feats: 32 21 | n_layer: 4 -------------------------------------------------------------------------------- /configs/restfnet_config.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | name: "adamw" 3 | lr: !!float 2e-4 4 | weight_decay: !!float 1e-6 5 | 6 | lr_scheduler: 7 | name: "multi_step" 8 | milestones: [400, 800, 1600] 9 | gamma: 0.4 10 | 11 | max_norm: 0.01 12 | 13 | path: 14 | # train_path: '/Data2/DataSet/HISR/CAVE/train_cave(with_up)x4.h5' 15 | # val_path: '/Data2/DataSet/HISR/CAVE/validation_cave(with_up)x4.h5' 16 | train_path: "/Data2/ZiHanCao/datasets/pansharpening/GF5_GF1/train_GF5_GF1.h5" 17 | val_path: "/Data2/Datasets/GF5_GF1/test_GF5_GF1-new.h5" 18 | 19 | # train_path: '/home/ZiHanCao/datasets/HISI/new_cave/train_cave(with_up)x4.h5' 20 | # val_path: '/home/ZiHanCao/datasets/HISI/new_cave/validation_cave(with_up)x4.h5' 21 | # train_path: '/home/ZiHanCao/datasets/HISI/new_harvard/train_harvard(with_up)x4_rgb.h5' 22 | # val_path: '/home/ZiHanCao/datasets/HISI/new_harvard/validation_harvard(with_up)x4_rgb.h5' 23 | 24 | network_configs: 25 | is_bn: yes 26 | n_select_bands: 4 27 | n_bands: 150 28 | 29 | logger_config: 30 | base_path: ./log_file/ 31 | name: restfnet_gf5 32 | file_mode: w -------------------------------------------------------------------------------- /configs/ssrnet_config.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | name: "adamw" 3 | lr: !!float 1e-3 4 | weight_decay: !!float 1e-6 5 | 6 | lr_scheduler: 7 | name: "multi_step" 8 | milestones: [400, 800] 9 | gamma: 0.1 10 | 11 | max_norm: 0.01 12 | 13 | path: 14 | # train_path: '/Data2/DataSet/HISR/CAVE/train_cave(with_up)x4.h5' 15 | # val_path: '/Data2/DataSet/HISR/CAVE/validation_cave(with_up)x4.h5' 16 | train_path: "/Data2/ZiHanCao/datasets/pansharpening/GF5-GF1/tap23/train_GF5_GF1_23tap_new.h5" 17 | val_path: "/Data2/ZiHanCao/datasets/pansharpening/GF5-GF1/tap23/test_GF5_GF1_23tap_new.h5" 18 | 19 | # train_path: '/home/ZiHanCao/datasets/HISI/new_cave/train_cave(with_up)x4.h5' 20 | # val_path: '/home/ZiHanCao/datasets/HISI/new_cave/validation_cave(with_up)x4.h5' 21 | # train_path: '/home/ZiHanCao/datasets/HISI/new_harvard/train_harvard(with_up)x4_rgb.h5' 22 | # val_path: '/home/ZiHanCao/datasets/HISI/new_harvard/validation_harvard(with_up)x4_rgb.h5' 23 | 24 | network_configs: 25 | arch: "SSRNET" 26 | n_bands: 150 27 | rgb_channel: 4 28 | scale_ratio: 2 29 | 30 | logger_config: 31 | base_path: ./log_file/ 32 | name: ssrnet_gf5 33 | file_mode: w 34 | -------------------------------------------------------------------------------- /configs/ydtr_config.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | name: 'adamw' 3 | lr: !!float 1e-4 4 | weight_decay: !!float 1e-6 5 | 6 | lr_scheduler: 7 | name: 'multi_step' 8 | milestones: [300, 600, 1000] 9 | gamma: 0.1 10 | # name: 'identity' 11 | 12 | max_norm: null 13 | 14 | path: 15 | # train_path: '/home/ZiHanCao/datasets/pansharpening/wv3/training_wv3/train_wv3.h5' 16 | # val_path: '/home/ZiHanCao/datasets/pansharpening/wv3/training_wv3/valid_wv3.h5' 17 | # train_path: "/home/ZiHanCao/datasets/HISI/new_cave/train_cave(with_up)x4.h5" 18 | # val_path: "/home/ShangqiDeng/data/HSI/cave_x4/test_cavepatches64-2.h5" 19 | # train_path: '/home/ZiHanCao/datasets/pansharpening/qb/training_qb/train_qb.h5' 20 | # val_path: '/home/ZiHanCao/datasets/pansharpening/qb/training_qb/valid_qb.h5' 21 | # train_path: '/home/ZiHanCao/datasets/pansharpening/gf/training_gf2/train_gf2.h5' 22 | # val_path: '/home/ZiHanCao/datasets/pansharpening/gf/training_gf2/valid_gf2.h5' 23 | 24 | base_dir: "/Data2/ZiHanCao/datasets/RoadScene_and_TNO/" 25 | 26 | network_configs: 27 | in_channel: 1 28 | out_channel: 64 29 | output_channel: 1 30 | img_size: 128 31 | 32 | 33 | logger_config: 34 | base_path: ./log_file/ 35 | name: dcfnet 36 | file_mode: w -------------------------------------------------------------------------------- /model/build_network.py: -------------------------------------------------------------------------------- 1 | from model.base_model import MODELS 2 | import importlib 3 | 4 | 5 | 6 | # if name == 'pannet': 7 | # return net(**kwargs) 8 | # elif name == 'fusionnet': 9 | # return net(8, 32) 10 | # elif name == 'panformer': 11 | # # return PanFormerUNet(8, multi_channels=(16, 32, 64)) 12 | # # return PanFormerSwitch(8, multi_channels=(27, 54, 108)) 13 | # return PanFormerUNet2(8, multi_channels=(16, 32, 64), hidden_c=64) 14 | # # return PanFormerGAU(8, hidden_c=64, multi_channels=(16, 32, 64), attn_drop=(0., 0.2, 0.4, 0.4)) 15 | # elif name == 'm3dnet': 16 | # return M3DNet(8, 1, 32, 4) 17 | # elif name == 'dcfnet': 18 | # return DCFNet(8, 'C') 19 | # else: 20 | # raise NotImplementedError 21 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cus/selective_scan_core_bwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel.cuh" 5 | 6 | template void selective_scan_bwd_cuda<1, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<1, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<1, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cus/selective_scan_core_fwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel.cuh" 5 | 6 | template void selective_scan_fwd_cuda<1, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<1, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<1, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusndstate/selective_scan_core_bwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_ndstate.cuh" 5 | 6 | template void selective_scan_bwd_cuda<1, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<1, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<1, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusndstate/selective_scan_core_fwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_ndstate.cuh" 5 | 6 | template void selective_scan_fwd_cuda<1, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<1, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<1, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_bwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_bwd_cuda<1, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<1, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<1, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_bwd2.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_bwd_cuda<2, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<2, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<2, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_bwd3.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_bwd_cuda<3, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<3, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<3, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_bwd4.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_bwd_cuda<4, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<4, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<4, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_fwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_fwd_cuda<1, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<1, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<1, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_fwd2.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_fwd_cuda<2, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<2, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<2, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_fwd3.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_fwd_cuda<3, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<3, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<3, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_fwd4.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_fwd_cuda<4, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<4, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<4, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusoflex/selective_scan_core_bwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_oflex.cuh" 5 | 6 | template void selective_scan_bwd_cuda<1, float, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<1, at::Half, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<1, at::BFloat16, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | template void selective_scan_bwd_cuda<1, at::Half, float, at::Half>(SSMParamsBwd ¶ms, cudaStream_t stream); 10 | template void selective_scan_bwd_cuda<1, at::BFloat16, float, at::BFloat16>(SSMParamsBwd ¶ms, cudaStream_t stream); 11 | 12 | -------------------------------------------------------------------------------- /model/mamba_scan/csrc/selective_scan/cusoflex/selective_scan_core_fwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_oflex.cuh" 5 | 6 | template void selective_scan_fwd_cuda<1, float, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<1, at::Half, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<1, at::BFloat16, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | template void selective_scan_fwd_cuda<1, at::Half, float, at::Half>(SSMParamsBase ¶ms, cudaStream_t stream); 10 | template void selective_scan_fwd_cuda<1, at::BFloat16, float, at::BFloat16>(SSMParamsBase ¶ms, cudaStream_t stream); 11 | 12 | -------------------------------------------------------------------------------- /model/mamba_scan/selective_scan.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: selective_scan 3 | Version: 0.0.3 4 | Summary: selective scan 5 | Home-page: https://github.com/state-spaces/mamba 6 | Author: Tri Dao, Albert Gu, Mzero 7 | Author-email: tri@tridao.me, agu@cs.cmu.edu, liuyue171@mails.ucas.ac.cn 8 | Classifier: Programming Language :: Python :: 3 9 | Classifier: License :: OSI Approved :: BSD License 10 | Classifier: Operating System :: Unix 11 | Requires-Python: >=3.7 12 | Description-Content-Type: text/markdown 13 | Requires-Dist: torch 14 | Requires-Dist: packaging 15 | Requires-Dist: ninja 16 | Requires-Dist: einops 17 | -------------------------------------------------------------------------------- /model/module/__init__.py: -------------------------------------------------------------------------------- 1 | from .patch_merge_module.import_module import PatchMergeModule -------------------------------------------------------------------------------- /model/module/helper_func.py: -------------------------------------------------------------------------------- 1 | from typing import Sequence 2 | from einops import rearrange 3 | import torch.nn as nn 4 | 5 | 6 | def exists(val): 7 | return val is not None 8 | 9 | 10 | def default(val, d): 11 | return val if exists(val) else d 12 | 13 | 14 | def empty(x): 15 | return x.numel() == 0 16 | 17 | 18 | def to_3d(x): 19 | return rearrange(x, "b c h w -> b (h w) c") 20 | 21 | 22 | def to_4d(x, h, w): 23 | return rearrange(x, "b (h w) c -> b c h w", h=h, w=w) 24 | 25 | 26 | def padding_to_multiple_of(n, mult): 27 | remainder = n % mult 28 | if remainder == 0: 29 | return 0 30 | return mult - remainder 31 | 32 | 33 | class MultiInputSequential(nn.Sequential): 34 | def forward(self, *input): 35 | for module in self: 36 | if isinstance(input, Sequence): 37 | input = module(*input) 38 | else: 39 | input = module(input) 40 | return input 41 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cus/selective_scan_core_bwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel.cuh" 5 | 6 | template void selective_scan_bwd_cuda<1, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<1, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<1, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cus/selective_scan_core_fwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel.cuh" 5 | 6 | template void selective_scan_fwd_cuda<1, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<1, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<1, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusndstate/selective_scan_core_bwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_ndstate.cuh" 5 | 6 | template void selective_scan_bwd_cuda<1, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<1, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<1, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusndstate/selective_scan_core_fwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_ndstate.cuh" 5 | 6 | template void selective_scan_fwd_cuda<1, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<1, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<1, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_bwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_bwd_cuda<1, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<1, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<1, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_bwd2.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_bwd_cuda<2, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<2, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<2, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_bwd3.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_bwd_cuda<3, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<3, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<3, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_bwd4.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_bwd_cuda<4, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<4, at::Half, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<4, at::BFloat16, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_fwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_fwd_cuda<1, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<1, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<1, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_fwd2.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_fwd_cuda<2, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<2, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<2, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_fwd3.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_fwd_cuda<3, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<3, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<3, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusnrow/selective_scan_core_fwd4.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_nrow.cuh" 5 | 6 | template void selective_scan_fwd_cuda<4, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<4, at::Half, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<4, at::BFloat16, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | 10 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusoflex/selective_scan_core_bwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_bwd_kernel_oflex.cuh" 5 | 6 | template void selective_scan_bwd_cuda<1, float, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 7 | template void selective_scan_bwd_cuda<1, at::Half, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 8 | template void selective_scan_bwd_cuda<1, at::BFloat16, float, float>(SSMParamsBwd ¶ms, cudaStream_t stream); 9 | template void selective_scan_bwd_cuda<1, at::Half, float, at::Half>(SSMParamsBwd ¶ms, cudaStream_t stream); 10 | template void selective_scan_bwd_cuda<1, at::BFloat16, float, at::BFloat16>(SSMParamsBwd ¶ms, cudaStream_t stream); 11 | 12 | -------------------------------------------------------------------------------- /model/module/mamba_scan/csrc/selective_scan/cusoflex/selective_scan_core_fwd.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | #include "selective_scan_fwd_kernel_oflex.cuh" 5 | 6 | template void selective_scan_fwd_cuda<1, float, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 7 | template void selective_scan_fwd_cuda<1, at::Half, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 8 | template void selective_scan_fwd_cuda<1, at::BFloat16, float, float>(SSMParamsBase ¶ms, cudaStream_t stream); 9 | template void selective_scan_fwd_cuda<1, at::Half, float, at::Half>(SSMParamsBase ¶ms, cudaStream_t stream); 10 | template void selective_scan_fwd_cuda<1, at::BFloat16, float, at::BFloat16>(SSMParamsBase ¶ms, cudaStream_t stream); 11 | 12 | -------------------------------------------------------------------------------- /model/module/mamba_scan/selective_scan.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: selective_scan 3 | Version: 0.0.3 4 | Summary: selective scan 5 | Home-page: https://github.com/state-spaces/mamba 6 | Author: Tri Dao, Albert Gu, Mzero 7 | Author-email: tri@tridao.me, agu@cs.cmu.edu, liuyue171@mails.ucas.ac.cn 8 | Classifier: Programming Language :: Python :: 3 9 | Classifier: License :: OSI Approved :: BSD License 10 | Classifier: Operating System :: Unix 11 | Requires-Python: >=3.7 12 | Description-Content-Type: text/markdown 13 | Requires-Dist: torch 14 | Requires-Dist: packaging 15 | Requires-Dist: ninja 16 | Requires-Dist: einops 17 | -------------------------------------------------------------------------------- /model/module/patch_merge_module/import_module.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import importlib.util 4 | 5 | current_dir = os.path.dirname(os.path.abspath(__file__)) 6 | 7 | py_ver = f"{sys.version_info.major}{sys.version_info.minor}" 8 | 9 | assert py_ver in ["37", "38", "39", "310", "312"], "Python version must be 3.7, 3.8, 3.9, 3.10, or 3.12" 10 | 11 | print('trying to import PatchMergeModule') 12 | if py_ver == "37": 13 | from .py37_module.PatchMergeModule import PatchMergeModule 14 | elif py_ver == "38": 15 | from .py38_module.PatchMergeModule import PatchMergeModule 16 | elif py_ver == "39": 17 | from .py39_module.PatchMergeModule import PatchMergeModule 18 | elif py_ver == "310": 19 | from .py310_module.PatchMergeModule import PatchMergeModule 20 | elif py_ver == "312": 21 | from .py312_module.PatchMergeModule import PatchMergeModule 22 | 23 | else: 24 | raise NotImplementedError(f"Python version {py_ver} is not supported.") -------------------------------------------------------------------------------- /model/module/patch_merge_module/py310_module/PatchMergeModule.cpython-310-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/patch_merge_module/py310_module/PatchMergeModule.cpython-310-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /model/module/patch_merge_module/py312_module/PatchMergeModule.cpython-312-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/patch_merge_module/py312_module/PatchMergeModule.cpython-312-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /model/module/patch_merge_module/py37_module/PatchMergeModule.cpython-37m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/patch_merge_module/py37_module/PatchMergeModule.cpython-37m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /model/module/patch_merge_module/py38_module/PatchMergeModule.cpython-38-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/patch_merge_module/py38_module/PatchMergeModule.cpython-38-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /model/module/patch_merge_module/py39_module/PatchMergeModule.cpython-39-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/patch_merge_module/py39_module/PatchMergeModule.cpython-39-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | causal-conv1d/causal_conv1d/__pycache__/* 3 | mamba/mamba_ssm/utils/__pycache__/* 4 | mamba/mamba_ssm/ops/triton/__pycache__/* 5 | mamba/mamba_ssm/ops/__pycache__/* 6 | mamba/mamba_ssm/modules/__pycache__/* 7 | mamba/mamba_ssm/__pycache__/* 8 | mamba/mamba_ssm/models/__pycache__/* 9 | causal-conv1d/build/ 10 | causal-conv1d/causal_conv1d.egg-info/ 11 | causal-conv1d/causal_conv1d_cuda.cpython-310-x86_64-linux-gnu.so 12 | mamba/build/ 13 | mamba/mamba_ssm.egg-info/ 14 | mamba/selective_scan_cuda.cpython-310-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/assets/vim_pipeline_v1.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/vim_module_used_in_panmamba_zhouman/Vim/assets/vim_pipeline_v1.9.png -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/assets/vim_teaser_v1.7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/vim_module_used_in_panmamba_zhouman/Vim/assets/vim_teaser_v1.7.png -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/causal-conv1d/AUTHORS: -------------------------------------------------------------------------------- 1 | Tri Dao, tri@tridao.me 2 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/causal-conv1d/README.md: -------------------------------------------------------------------------------- 1 | # Causal depthwise conv1d in CUDA with a PyTorch interface 2 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/causal-conv1d/causal_conv1d-1.0.0+cu118torch2.2cxx11abiFALSE-cp39-cp39-linux_x86_64.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/vim_module_used_in_panmamba_zhouman/Vim/causal-conv1d/causal_conv1d-1.0.0+cu118torch2.2cxx11abiFALSE-cp39-cp39-linux_x86_64.whl -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/causal-conv1d/causal_conv1d/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "1.0.0" 2 | 3 | from causal_conv1d.causal_conv1d_interface import causal_conv1d_fn, causal_conv1d_update 4 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/.gitignore: -------------------------------------------------------------------------------- 1 | *__pycache__/ 2 | *.egg-info/ 3 | build/ 4 | **.so 5 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "3rdparty/lm-evaluation-harness"] 2 | path = 3rdparty/lm-evaluation-harness 3 | url = https://github.com/EleutherAI/lm-evaluation-harness/ 4 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/AUTHORS: -------------------------------------------------------------------------------- 1 | Tri Dao, tri@tridao.me 2 | Albert Gu, agu@andrew.cmu.edu 3 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/assets/selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/assets/selection.png -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/csrc/selective_scan/selective_scan_bwd_bf16_complex.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | 5 | // Split into multiple files to compile in paralell 6 | 7 | #include "selective_scan_bwd_kernel.cuh" 8 | 9 | template void selective_scan_bwd_cuda(SSMParamsBwd ¶ms, cudaStream_t stream); -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/csrc/selective_scan/selective_scan_bwd_bf16_real.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | 5 | // Split into multiple files to compile in paralell 6 | 7 | #include "selective_scan_bwd_kernel.cuh" 8 | 9 | template void selective_scan_bwd_cuda(SSMParamsBwd ¶ms, cudaStream_t stream); -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/csrc/selective_scan/selective_scan_bwd_fp16_complex.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | 5 | // Split into multiple files to compile in paralell 6 | 7 | #include "selective_scan_bwd_kernel.cuh" 8 | 9 | template void selective_scan_bwd_cuda(SSMParamsBwd ¶ms, cudaStream_t stream); -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/csrc/selective_scan/selective_scan_bwd_fp16_real.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | 5 | // Split into multiple files to compile in paralell 6 | 7 | #include "selective_scan_bwd_kernel.cuh" 8 | 9 | template void selective_scan_bwd_cuda(SSMParamsBwd ¶ms, cudaStream_t stream); -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/csrc/selective_scan/selective_scan_bwd_fp32_complex.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | 5 | // Split into multiple files to compile in paralell 6 | 7 | #include "selective_scan_bwd_kernel.cuh" 8 | 9 | template void selective_scan_bwd_cuda(SSMParamsBwd ¶ms, cudaStream_t stream); -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/csrc/selective_scan/selective_scan_bwd_fp32_real.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | 5 | // Split into multiple files to compile in paralell 6 | 7 | #include "selective_scan_bwd_kernel.cuh" 8 | 9 | template void selective_scan_bwd_cuda(SSMParamsBwd ¶ms, cudaStream_t stream); -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/csrc/selective_scan/selective_scan_fwd_bf16.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | 5 | // Split into multiple files to compile in paralell 6 | 7 | #include "selective_scan_fwd_kernel.cuh" 8 | 9 | template void selective_scan_fwd_cuda(SSMParamsBase ¶ms, cudaStream_t stream); 10 | template void selective_scan_fwd_cuda(SSMParamsBase ¶ms, cudaStream_t stream); -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/csrc/selective_scan/selective_scan_fwd_fp16.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | 5 | // Split into multiple files to compile in paralell 6 | 7 | #include "selective_scan_fwd_kernel.cuh" 8 | 9 | template void selective_scan_fwd_cuda(SSMParamsBase ¶ms, cudaStream_t stream); 10 | template void selective_scan_fwd_cuda(SSMParamsBase ¶ms, cudaStream_t stream); -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/csrc/selective_scan/selective_scan_fwd_fp32.cu: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2023, Tri Dao. 3 | ******************************************************************************/ 4 | 5 | // Split into multiple files to compile in paralell 6 | 7 | #include "selective_scan_fwd_kernel.cuh" 8 | 9 | template void selective_scan_fwd_cuda(SSMParamsBase ¶ms, cudaStream_t stream); 10 | template void selective_scan_fwd_cuda(SSMParamsBase ¶ms, cudaStream_t stream); -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "1.1.1" 2 | 3 | from mamba_ssm.ops.selective_scan_interface import selective_scan_fn, mamba_inner_fn 4 | from mamba_ssm.modules.mamba_simple import Mamba 5 | from mamba_ssm.models.mixer_seq_simple import MambaLMHeadModel 6 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/models/__init__.py -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/models/config_mamba.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass, field 2 | 3 | 4 | @dataclass 5 | class MambaConfig: 6 | 7 | d_model: int = 2560 8 | n_layer: int = 64 9 | vocab_size: int = 50277 10 | ssm_cfg: dict = field(default_factory=dict) 11 | rms_norm: bool = True 12 | residual_in_fp32: bool = True 13 | fused_add_norm: bool = True 14 | pad_vocab_size_multiple: int = 8 15 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/modules/__init__.py -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/ops/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/ops/__init__.py -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/ops/triton/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/ops/triton/__init__.py -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/utils/__init__.py -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/mamba-1p1p1/mamba_ssm/utils/hf.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | import torch 4 | 5 | from transformers.utils import WEIGHTS_NAME, CONFIG_NAME 6 | from transformers.utils.hub import cached_file 7 | 8 | 9 | def load_config_hf(model_name): 10 | resolved_archive_file = cached_file(model_name, CONFIG_NAME, _raise_exceptions_for_missing_entries=False) 11 | return json.load(open(resolved_archive_file)) 12 | 13 | 14 | def load_state_dict_hf(model_name, device=None, dtype=None): 15 | # If not fp32, then we don't want to load directly to the GPU 16 | mapped_device = "cpu" if dtype not in [torch.float32, None] else device 17 | resolved_archive_file = cached_file(model_name, WEIGHTS_NAME, _raise_exceptions_for_missing_entries=False) 18 | return torch.load(resolved_archive_file, map_location=mapped_device) 19 | # Convert dtype before moving to GPU to save memory 20 | if dtype is not None: 21 | state_dict = {k: v.to(dtype=dtype) for k, v in state_dict.items()} 22 | state_dict = {k: v.to(device=device) for k, v in state_dict.items()} 23 | return state_dict 24 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/vim/.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | **/__pycache__/** 3 | imnet_resnet50_scratch/timm_temp/ 4 | .dumbo.json 5 | checkpoints/ 6 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/vim/hubconf.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015-present, Facebook, Inc. 2 | # All rights reserved. 3 | from models import * 4 | from cait_models import * 5 | from resmlp_models import * 6 | #from patchconvnet_models import * 7 | 8 | dependencies = ["torch", "torchvision", "timm"] 9 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/vim/scripts/ft-vim-s.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | conda activate 3 | cd /vim; 4 | 5 | CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -m torch.distributed.launch --nproc_per_node=8 --use_env main.py --model vim_small_patch16_stride8_224_bimambav2_final_pool_mean_abs_pos_embed_with_midclstok_div2 --batch-size 128 --lr 5e-6 --min-lr 1e-5 --warmup-lr 1e-5 --drop-path 0.0 --weight-decay 1e-8 --num_workers 25 --data-path --output_dir ./output/vim_small_patch16_stride8_224_bimambav2_final_pool_mean_abs_pos_embed_with_midclstok_div2 --epochs 30 --finetune --no_amp 6 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/vim/scripts/ft-vim-t.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | conda activate 3 | cd /vim; 4 | 5 | CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -m torch.distributed.launch --nproc_per_node=8 --use_env main.py --model vim_tiny_patch16_stride8_224_bimambav2_final_pool_mean_abs_pos_embed_with_midclstok_div2 --batch-size 128 --lr 5e-6 --min-lr 1e-5 --warmup-lr 1e-5 --drop-path 0.0 --weight-decay 1e-8 --num_workers 25 --data-path --output_dir ./output/vim_tiny_patch16_stride8_224_bimambav2_final_pool_mean_abs_pos_embed_with_midclstok_div2 --epochs 30 --finetune --no_amp 6 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/vim/scripts/pt-vim-s.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | conda activate 3 | cd /vim; 4 | 5 | CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -m torch.distributed.launch --nproc_per_node=8 --use_env main.py --model vim_small_patch16_224_bimambav2_final_pool_mean_abs_pos_embed_with_midclstok_div2 --batch-size 64 --drop-path 0.05 --weight-decay 0.05 --lr 1e-3 --num_workers 25 --data-path --output_dir ./output/vim_small_patch16_224_bimambav2_final_pool_mean_abs_pos_embed_with_midclstok_div2 --no_amp 6 | -------------------------------------------------------------------------------- /model/module/vim_module_used_in_panmamba_zhouman/Vim/vim/scripts/pt-vim-t.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | conda activate 3 | cd /vim; 4 | 5 | CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -m torch.distributed.launch --nproc_per_node=8 --use_env main.py --model vim_tiny_patch16_224_bimambav2_final_pool_mean_abs_pos_embed_with_midclstok_div2 --batch-size 128 --drop-path 0.0 --weight-decay 0.1 --num_workers 25 --data-path --output_dir ./output/vim_tiny_patch16_224_bimambav2_final_pool_mean_abs_pos_embed_with_midclstok_div2 --no_amp 6 | -------------------------------------------------------------------------------- /readmes/figs/le-mamba-HMIF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/readmes/figs/le-mamba-HMIF.png -------------------------------------------------------------------------------- /readmes/figs/le-mamba-pansharpening.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/readmes/figs/le-mamba-pansharpening.png -------------------------------------------------------------------------------- /readmes/figs/le-mamba-teaser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/readmes/figs/le-mamba-teaser.png -------------------------------------------------------------------------------- /requirement.txt: -------------------------------------------------------------------------------- 1 | torch 2 | torch_ema 3 | einops 4 | matplotlib 5 | scikit-learn 6 | scikit-image 7 | kornia 8 | shortuuid 9 | aim 10 | wandb 11 | opencv-python-headless 12 | rich 13 | beartype 14 | lpips 15 | bytecode 16 | timm 17 | h5py 18 | torchsummary 19 | fvcore 20 | tensorboard 21 | colored_traceback 22 | transformers 23 | accelerate 24 | huggingface-hub 25 | safetensors 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /scripts/accelerate_run.sh: -------------------------------------------------------------------------------- 1 | CUDA_VISIBLE_DEVICES="0" \ 2 | NCCL_P2P_LEVEL="NVL" \ 3 | NCCL_P2P_DISABLE="1" \ 4 | NCCL_IB_DISABLE="1" \ 5 | OMP_NUM_THREADS="6" \ 6 | accelerate launch \ 7 | --config_file configs/huggingface/accelerate.yaml \ 8 | accelerate_main.py \ 9 | --proj_name LE-Mamba \ 10 | --arch LEMamba \ 11 | --dataset wv3 \ 12 | --num_worker 6 -e 800 -b 32 --aug_probs 0. 0. --loss l1ssim --grad_accum_steps 2 \ 13 | --checkpoint_every_n 20 --val_n_epoch 20 \ 14 | --comment "LE-Mamba config on wv3 dataset model" \ 15 | --log_metric \ 16 | --logger_on \ -------------------------------------------------------------------------------- /scripts/torch_sharpening_run.sh: -------------------------------------------------------------------------------- 1 | ## MIMO_SST arch 2 | python main.py --proj_name MIMO_SST --arch MIMO_SST \ 3 | -b 32 --device 'cuda:0' --dataset 'wv3' \ 4 | --warm_up_epochs 10 --num_worker 6 -e 2000 --aug_probs 0. 0. \ 5 | --loss l1ssim --val_n_epoch 20 --comment 'MIMO_SST reduced arch on wv3 dataset' \ 6 | --log_metrics \ 7 | --logger_on \ 8 | # --pretrain --pretrain_id 'd02s63w5' 9 | -------------------------------------------------------------------------------- /task_datasets/__init__.py: -------------------------------------------------------------------------------- 1 | from .prefetcher import DataPrefetcher 2 | 3 | # datasets cls 4 | from .WV3 import * 5 | from .GF2 import * 6 | from .HISR import * 7 | 8 | -------------------------------------------------------------------------------- /task_datasets/prefetcher.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | 4 | class DataPrefetcher: 5 | def __init__(self, loader): 6 | self.loader = iter(loader) 7 | self.stream = torch.cuda.Stream() 8 | self.preload() 9 | 10 | def preload(self): 11 | try: 12 | self.next_input, self.next_target = next(self.loader) 13 | except StopIteration: 14 | self.next_input = None 15 | self.next_target = None 16 | return 17 | 18 | with torch.cuda.stream(self.stream): 19 | self.next_input = self.next_input.cuda(non_blocking=True) 20 | self.next_target = self.next_target.cuda(non_blocking=True) 21 | 22 | def next(self): 23 | torch.cuda.current_stream().wait_stream(self.stream) 24 | input = self.next_input 25 | target = self.next_target 26 | if input is not None: 27 | self.preload() 28 | return input, target -------------------------------------------------------------------------------- /teasers/FeINFN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/teasers/FeINFN.png -------------------------------------------------------------------------------- /teasers/fusion-00004N.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/teasers/fusion-00004N.png -------------------------------------------------------------------------------- /teasers/ir-00004N.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/teasers/ir-00004N.png -------------------------------------------------------------------------------- /teasers/tesear-seg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/teasers/tesear-seg.png -------------------------------------------------------------------------------- /teasers/vi-00004N.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/teasers/vi-00004N.png -------------------------------------------------------------------------------- /teasers/yolov5-after-fused.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/teasers/yolov5-after-fused.jpg -------------------------------------------------------------------------------- /teasers/yolov5-before-fused.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/teasers/yolov5-before-fused.jpg -------------------------------------------------------------------------------- /utils/FS_index/__init__.py: -------------------------------------------------------------------------------- 1 | # GPL License 2 | # Copyright (C) UESTC 3 | # All Rights Reserved 4 | # @Author : Xiao Wu 5 | # @reference: 6 | from . import * -------------------------------------------------------------------------------- /utils/FS_index/genMTF_pan.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import numpy as np 3 | from .tools import fir_filter_wind, gaussian2d, kaiser2d 4 | 5 | 6 | def genMTF_pan(ratio, sensor, nbands): 7 | N = 41 8 | 9 | if sensor == 'QB': 10 | GNyq = 0.15 11 | elif sensor == 'IKONOS': 12 | GNyq = 0.17 13 | elif sensor in ['GeoEye1', 'WV4']: 14 | GNyq = 0.16 15 | elif sensor == 'WV2': 16 | GNyq = 0.11 17 | elif sensor == 'WV3': 18 | GNyq = 0.14 19 | else: 20 | GNyq = 0.15 21 | 22 | """MTF""" 23 | fcut = 1 / ratio 24 | # h = np.zeros((N, N, nbands)) 25 | alpha = np.sqrt(((N - 1) * (fcut / 2)) ** 2 / (-2 * np.log(GNyq))) 26 | H = gaussian2d(N, alpha) 27 | Hd = H / np.max(H) 28 | w = kaiser2d(N, 0.5) 29 | h = np.real(fir_filter_wind(Hd, w)) 30 | 31 | return h 32 | -------------------------------------------------------------------------------- /utils/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import warnings 3 | warnings.filterwarnings("ignore", module="torch.utils") 4 | warnings.filterwarnings("ignore", module="deepspeed.accelerator") 5 | 6 | root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) 7 | cache_dir = os.path.join(root_dir, '.cache') 8 | 9 | os.environ["MPLCONFIGDIR"] = os.path.join(cache_dir, "matplotlib") 10 | os.environ["HF_HOME"] = os.path.join(cache_dir, "hf_home") 11 | 12 | from dataclasses import dataclass 13 | 14 | from .metric_sharpening import * 15 | from .log_utils import * 16 | from .misc import * 17 | from .misc import recursive_search_dict2namespace as convert_config_dict 18 | from .load_params import * 19 | from .optim_utils import * 20 | from .network_utils import * 21 | from .visualize import * 22 | from .inference_helper_func import * 23 | from .loss_utils import * 24 | from .save_checker import * 25 | from .train_utils import * 26 | from .progress_utils import * 27 | from .model_perf_utils import * 28 | from .ema_utils import * 29 | 30 | config_load = yaml_load 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /utils/ema_utils/__init__.py: -------------------------------------------------------------------------------- 1 | from .ema import EMA 2 | 3 | from .post_hoc_ema import ( 4 | KarrasEMA, 5 | PostHocEMA 6 | ) -------------------------------------------------------------------------------- /utils/loss_landscape/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.DS_Store 3 | *.t7 4 | *.pth 5 | *.pdf 6 | cifar10/plots/*.png 7 | cifar10/plots/*.h5 8 | cifar10/data/ 9 | cifar10/trained_nets/ 10 | -------------------------------------------------------------------------------- /utils/loss_landscape/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer and Tom Goldstein 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in the 5 | Software without restriction, including without limitation the rights to use, copy, 6 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 7 | and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 18 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /utils/loss_landscape/cifar10/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/utils/loss_landscape/cifar10/__init__.py -------------------------------------------------------------------------------- /utils/loss_landscape/cifar10/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/utils/loss_landscape/cifar10/models/__init__.py -------------------------------------------------------------------------------- /utils/loss_landscape/doc/images/resnet56_noshort_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/utils/loss_landscape/doc/images/resnet56_noshort_small.jpg -------------------------------------------------------------------------------- /utils/loss_landscape/doc/images/resnet56_sgd_lr=0.1_bs=128_wd=0.0005/model_300.t7_weights_xignore=biasbn_xnorm=filter_yignore=biasbn_ynorm=filter.h5_[-1.0,1.0,51]x[-1.0,1.0,51].h5_train_loss_2dcontour.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/utils/loss_landscape/doc/images/resnet56_sgd_lr=0.1_bs=128_wd=0.0005/model_300.t7_weights_xignore=biasbn_xnorm=filter_yignore=biasbn_ynorm=filter.h5_[-1.0,1.0,51]x[-1.0,1.0,51].h5_train_loss_2dcontour.jpg -------------------------------------------------------------------------------- /utils/loss_landscape/doc/images/resnet56_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/utils/loss_landscape/doc/images/resnet56_small.jpg -------------------------------------------------------------------------------- /utils/loss_landscape/doc/images/vgg9_sgd_lr=0.1_bs=128_wd=0.0005_save_epoch=1_model_300.t7_vgg9_sgd_lr=0.1_bs=8192_wd=0.0005_save_epoch=1_model_300.t7_states.h5_[-1.0,1.0,401].h5_1d_loss_acc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/utils/loss_landscape/doc/images/vgg9_sgd_lr=0.1_bs=128_wd=0.0005_save_epoch=1_model_300.t7_vgg9_sgd_lr=0.1_bs=8192_wd=0.0005_save_epoch=1_model_300.t7_states.h5_[-1.0,1.0,401].h5_1d_loss_acc.jpg -------------------------------------------------------------------------------- /utils/loss_landscape/doc/images/vgg9_sgd_lr=0.1_bs=128_wd=0.0_save_epoch=1/model_300.t7_weights_xignore=biasbn_xnorm=filter.h5_[-1.0,1.0,51].h5_1d_loss_acc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/utils/loss_landscape/doc/images/vgg9_sgd_lr=0.1_bs=128_wd=0.0_save_epoch=1/model_300.t7_weights_xignore=biasbn_xnorm=filter.h5_[-1.0,1.0,51].h5_1d_loss_acc.jpg -------------------------------------------------------------------------------- /utils/loss_landscape/doc/images/vgg9_sgd_lr=0.1_bs=128_wd=0.0_save_epoch=1_model_300.t7_vgg9_sgd_lr=0.1_bs=8192_wd=0.0_save_epoch=1_model_300.t7_states.h5_[-1.0,1.0,401].h5_1d_loss_acc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/294coder/Efficient-MIF/134434abbabc894da07a3e10841729c668b0290a/utils/loss_landscape/doc/images/vgg9_sgd_lr=0.1_bs=128_wd=0.0_save_epoch=1_model_300.t7_vgg9_sgd_lr=0.1_bs=8192_wd=0.0_save_epoch=1_model_300.t7_states.h5_[-1.0,1.0,401].h5_1d_loss_acc.jpg -------------------------------------------------------------------------------- /utils/loss_landscape/h5_util.py: -------------------------------------------------------------------------------- 1 | """ 2 | Serialization and deserialization of directions in the direction file. 3 | """ 4 | 5 | import torch 6 | 7 | def write_list(f, name, direction): 8 | """ Save the direction to the hdf5 file with name as the key 9 | 10 | Args: 11 | f: h5py file object 12 | name: key name_surface_file 13 | direction: a list of tensors 14 | """ 15 | 16 | grp = f.create_group(name) 17 | for i, l in enumerate(direction): 18 | if isinstance(l, torch.Tensor): 19 | l = l.numpy() 20 | grp.create_dataset(str(i), data=l) 21 | 22 | 23 | def read_list(f, name): 24 | """ Read group with name as the key from the hdf5 file and return a list numpy vectors. """ 25 | grp = f[name] 26 | return [grp[str(i)] for i in range(len(grp))] 27 | -------------------------------------------------------------------------------- /utils/loss_landscape/model_loader.py: -------------------------------------------------------------------------------- 1 | import os 2 | import cifar10.model_loader 3 | 4 | def load(dataset, model_name, model_file, data_parallel=False): 5 | if dataset == 'cifar10': 6 | net = cifar10.model_loader.load(model_name, model_file, data_parallel) 7 | return net 8 | -------------------------------------------------------------------------------- /utils/loss_landscape/script/2d_contour_resnet_noshort.sh: -------------------------------------------------------------------------------- 1 | # =========================================================== 2 | # 2d loss contours for ResNet-56-noshort 3 | # =========================================================== 4 | 5 | mpirun -n 4 python plot_surface.py --x=-1:1:51 --y=-1:1:51 --model resnet56_noshort \ 6 | --model_file cifar10/trained_nets/resnet56_noshort_sgd_lr=0.1_bs=128_wd=0.0005/model_300.t7 \ 7 | --mpi --cuda --xignore biasbn --xnorm filter --yignore biasbn --ynorm filter 8 | 9 | # =========================================================== 10 | # 2d loss contours for ResNet-110-noshort 11 | # =========================================================== 12 | mpirun -n 4 python plot_surface.py --x=-1:1:51 --y=-1:1:51 --model resnet110_noshort \ 13 | --model_file cifar10/trained_nets/resnet110_noshort_lr=0.01_bs=128/model_300.t7 --mpi --cuda \ 14 | --dir_type weights --xignore biasbn --xnorm filter --yignore biasbn --ynorm filter 15 | -------------------------------------------------------------------------------- /utils/sharpening_index/__init__.py: -------------------------------------------------------------------------------- 1 | # GPL License 2 | # Copyright (C) UESTC 3 | # All Rights Reserved 4 | # @Author : Xiao Wu 5 | # @reference: 6 | from . import * -------------------------------------------------------------------------------- /utils/sharpening_index/genMTF_pan.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import numpy as np 3 | from .tools import fir_filter_wind, gaussian2d, kaiser2d 4 | 5 | 6 | def genMTF_pan(ratio, sensor, nbands): 7 | N = 41 8 | 9 | if sensor == 'QB': 10 | GNyq = 0.15 11 | elif sensor == 'IKONOS': 12 | GNyq = 0.17 13 | elif sensor in ['GeoEye1', 'WV4']: 14 | GNyq = 0.16 15 | elif sensor == 'WV2': 16 | GNyq = 0.11 17 | elif sensor == 'WV3': 18 | GNyq = 0.14 19 | else: 20 | GNyq = 0.15 21 | 22 | """MTF""" 23 | fcut = 1 / ratio 24 | # h = np.zeros((N, N, nbands)) 25 | alpha = np.sqrt(((N - 1) * (fcut / 2)) ** 2 / (-2 * np.log(GNyq))) 26 | H = gaussian2d(N, alpha) 27 | Hd = H / np.max(H) 28 | w = kaiser2d(N, 0.5) 29 | h = np.real(fir_filter_wind(Hd, w)) 30 | 31 | return h 32 | -------------------------------------------------------------------------------- /utils/utils_modules/__init__.py: -------------------------------------------------------------------------------- 1 | from .adam_mini import Adam_mini 2 | from .unet5 import UNet5 as TranslationUnet --------------------------------------------------------------------------------