Package: gedml
News[2022-3-22]: **v0.2.2has been released:Fix some bugs.[2021-11-3]: **v0.2.0has been released:New features:Change the format oflinkconfiguration.[2021-10-27]: **v0.1.4has been released:New features:Add contrastive representation learning methods (MoCo-V2).[2021-10-24]: **v0.1.2has been released:New features:Add distributed (DDP) support.[2021-10-7]: **v0.1.1has been released:New features:Change the Cars196 loadingmethod.[2021-9-15]: **v0.1.0has been released:New features:output_wrapperandpipeline settingare decomposed for convenience.Pipeline will be stored in the experiment folder using a directed graph.[2021-9-13]: **v0.0.1has been released:New features:config.yamlwill be created to store the configuration in the experiment folder.**[2021-9-6]:v0.0.0has been released.IntroductionGeDMLis an easy-to-usegeneralized deep metric learninglibrary, which contains:State-of-the-art DML algorithms:We contrain 18+ losses functions and 6+ sampling strategies, and divide these algorithms into three categories (i.e., collectors, selectors, and losses).Bridge bewteen DML and SSL: We attempt to bridge the gap between deep metric learning and self-supervised learning through specially designed modules, such ascollectors.Auxiliary modules to assist in building:We also encapsulates the upper interface for users to start programs quickly and separates the codes and configs for managing hyper-parameters conveniently.InstallationPippipinstallgedmlQuickstartDemo 1:deep metric learningCUDA_VISIBLE_DEVICES=0pythondemo.py\--data_path<path_to_data>\--save_path<path_to_save>\--eval_excludef1_scoreNMIAMI\--device0--batch_size128--test_batch_size128\--settingproxy_anchor--splits_to_evaltest--embeddings_dim128\--lr_trunk0.0001--lr_embedder0.0001--lr_collector0.01\--datasetcub200--delete_old\Demo 2:contrastive representation learningCUDA_VISIBLE_DEVICES=0pythondemo.py\--data_path<path_to_data>\--save_path<path_to_save>\--eval_excludef1_scoreNMIAMI\--device0--batch_size128--test_batch_size128\--settingmocov2--splits_to_evaltest--embeddings_dim128\--lr_trunk0.015--lr_embedder0.015\--datasetimagenet--delete_old\If you want to use our code to conductDMLorCRLexperiments, please refer to theup-to-dateandmost detailedconfigurationsbelow: :point_down:If you use the command line, you can runsample_run.shto try this project.If you debug with VS Code, you can refer tolaunch.jsonto set.vscode.APIInitializationUseParserWithConvertto get parameters>>>fromgedml.launcher.miscimportParserWithConvert>>>csv_path=...>>>parser=ParserWithConvert(csv_path=csv_path,name="...")>>>opt,convert_dict=parser.render()UseConfigHandlerto create all objects.>>>fromgedml.launcher.creatorsimportConfigHandler>>>link_path=...>>>assert_path=...>>>param_path=...>>>config_handler=ConfigHandler(convert_dict=convert_dict,link_path=link_path,assert_path=assert_path,params_path=param_path,is_confirm_first=True)>>>config_handler.get_params_dict()>>>objects_dict=config_handler.create_all()StartUsemanagerto automatically calltrainerandtester.>>>fromgedml.launcher.miscimportutils>>>manager=utils.get_default(objects_dict,"managers")>>>manager.run()Or directly usetrainerandtester.>>>fromgedml.launcher.miscimportutils>>>trainer=utils.get_default(objects_dict,"trainers")>>>tester=utils.get_default(objects_dict,"testers")>>>recorder=utils.get_default(objects_dict,"recorders")# start to train>>>utils.func_params_mediator([objects_dict],trainer.__call__)# start to test>>>metrics=utils.func_params_mediator([{"recorders":recorder},objects_dict,],tester.__call__)DocumentFor more information, please refer to: :point_right:Docs:book:Some specific guidances:How to write configHow to define custom module...ConfigsWe will continually update the optimal parameters of different configs inTsinghuaCloudFrameworkThis project is modular in design. The pipeline diagram is as follows:Code structuretests: Debug files.examples: Demos.config: Folder which storeslinks,param,wrapper,args.yamlandassert.yaml.demo.py: A demo python file.src/gedml: Main code.core: Losses, selectors, collectors, etc.client: Tmux manager.config: Config files which define the hyper-string etc.launcher: Manager, Trainer, Tester, etc.recorder: Recorder.MethodCollectorsmethoddescriptionBaseCollectorBase classDefaultCollectorDo nothingProxyCollectorMaintain a set of proxiesMoCoCollectorpaper:Momentum Contrast for Unsupervised Visual Representation LearningSimSiamCollectorpaper:Exploring Simple Siamese Representation LearningHDMLCollectorpaper:Hardness-Aware Deep Metric LearningDAMLCollectorpaper:Deep Adversarial Metric LearningDVMLCollectorpaper:Deep Variational Metric LearningLossesclassifier-basedmethoddescriptionCrossEntropyLossCross entropy loss for unsupervised methodsLargeMarginSoftmaxLosspaper:Large-Margin Softmax Loss for Convolutional Neural NetworksArcFaceLosspaper:ArcFace: Additive Angular Margin Loss for Deep Face RecognitionCosFaceLosspaper:CosFace: Large Margin Cosine Loss for Deep Face Recognitionpair-basedmethoddescriptionContrastiveLosspaper:Learning a Similarity Metric Discriminatively, with Application to Face VerificationMarginLosspaper:Sampling Matters in Deep Embedding LearningTripletLosspaper:Learning local feature descriptors with triplets and shallow convolutional neural networksAngularLosspaper:Deep Metric Learning with Angular LossCircleLosspaper:Circle Loss: A Unified Perspective of Pair Similarity OptimizationFastAPLosspaper:Deep Metric Learning to RankLiftedStructureLosspaper:Deep Metric Learning via Lifted Structured Feature EmbeddingMultiSimilarityLosspaper:Multi-Similarity Loss With General Pair Weighting for Deep Metric LearningNPairLosspaper:Improved Deep Metric Learning with Multi-class N-pair Loss ObjectiveSignalToNoiseRatioLosspaper:Signal-To-Noise Ratio: A Robust Distance Metric for Deep Metric LearningPosPairLosspaper:Exploring Simple Siamese Representation Learningproxy-basedmethoddescriptionProxyLosspaper:No Fuss Distance Metric Learning Using ProxiesProxyAnchorLosspaper:Proxy Anchor Loss for Deep Metric LearningSoftTripleLosspaper:SoftTriple Loss: Deep Metric Learning Without Triplet SamplingSelectorsmethoddescriptionBaseSelectorBase classDefaultSelectorDo nothingDenseTripletSelectorSelect all triplesDensePairSelectorSelect all pairsCode ReferenceKevinMusgrave / pytorch-metric-learningKevinMusgrave / powerful-benchmarkerConfusezius / Deep-Metric-Learning-Baselinesfacebookresearch / mocoPatrickHua / SimSiamujjwaltiwari / Deep_Variational_Metric_Learningidstcv / SoftTriplewzzheng / HDMLgoogle-research / simclrkunhe / FastAP-metric-learningwy1iu / LargeMargin_Softmax_Losstjddus9597 / Proxy-Anchor-CVPR2020facebookresearch / deitTODO:assert parameters.write github action to automate unit-test, package publish and docs building.add cross-validation splits protocol.distributed tester for matrix-form input.add metrics module.how to improve the running efficiency.IMPORTANT TODO:re-define pipeline setting!!!simplify distribution setting!!