{"id":21910488,"url":"https://github.com/chenshen03/deephash-pytorch","last_synced_at":"2026-03-09T07:36:09.931Z","repository":{"id":165768747,"uuid":"191363050","full_name":"chenshen03/DeepHash-pytorch","owner":"chenshen03","description":"基于PyTorch的DeepHash框架","archived":false,"fork":false,"pushed_at":"2019-07-09T05:26:55.000Z","size":73,"stargazers_count":5,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-16T02:50:38.472Z","etag":null,"topics":["deephash","hash","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chenshen03.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-11T12:01:54.000Z","updated_at":"2022-07-14T02:40:56.000Z","dependencies_parsed_at":"2023-06-03T02:30:42.098Z","dependency_job_id":null,"html_url":"https://github.com/chenshen03/DeepHash-pytorch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chenshen03/DeepHash-pytorch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenshen03%2FDeepHash-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenshen03%2FDeepHash-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenshen03%2FDeepHash-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenshen03%2FDeepHash-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chenshen03","download_url":"https://codeload.github.com/chenshen03/DeepHash-pytorch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenshen03%2FDeepHash-pytorch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263290848,"owners_count":23443666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deephash","hash","pytorch"],"created_at":"2024-11-28T17:31:16.622Z","updated_at":"2026-03-09T07:36:04.887Z","avatar_url":"https://github.com/chenshen03.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeepHash-Pytoch\nPyTorch implementation for DeepHash framework\n\n## Prerequisites\nLinux or OSX\n\nNVIDIA GPU + CUDA (may CuDNN) and corresponding PyTorch framework (version 1.0.0)\n\nPython 3.6\n\n## Datasets\nWe use ImageNet, NUS-WIDE and COCO dataset in our experiments. You can download the ImageNet dataset and NUS-WIDE dataset [here](https://drive.google.com/drive/folders/0B7IzDz-4yH_HOXdoaDU4dk40RFE?usp=sharing).\nAs for COCO dataset, we use COCO 2014, which can be downloaded [here](http://mscoco.org/dataset/#download). And in case of COCO changes in the future, we also provide a download link [here](https://drive.google.com/drive/folders/0B7IzDz-4yH_HOXdoaDU4dk40RFE?usp=sharing) on google drive.\nAfter downloading, you need to move the imagenet.tar.gz to [./data/imagenet](./data/imagenet) and extract the file there.\n```\nmv imagenet.tar.gz ./data/imagenet\ncd ./data/imagenet\ntar -zxvf imagenet.tar.gz\n```\nAlso, for NUS-WIDE, you need to move the nus_wide.tar.gz to [./data/nuswide_81](./data/nuswide_81) and extract the file there. \n```\nmv nus_wide.tar.gz ./data/nus_wide\ncd ./data/nus_wide\ntar -zxvf nus_wide.tar.gz\n```\nFor COCO dataset, you need to extract both train and val archive for COCO in [./data/coco](./data/coco).\nIf you download from [COCO download page](http://mscoco.org/dataset/#download),\n```\nmv train2014.zip ./data/coco\nmv val2014.zip ./data/coco\ncd ./data/coco\nunzip train2014.zip\nunzip val2014.zip\n```\nIf you use our shared [link](https://drive.google.com/drive/folders/0B7IzDz-4yH_HOXdoaDU4dk40RFE?usp=sharing)\n```\nmv coco.tar.gz ./data/coco\ncd ./data/coco\ntar -zxvf coco.tar.gz\nunzip train2014.zip\nunzip val2014.zip\n```\n\nYou can also modify the list file(txt format) in ./data as you like. Each line in the list file follows the following format:\n```\n\u003cimage path\u003e\u003cspace\u003e\u003cone hot label representation\u003e\n```\n\n## Training\nFirst, you can manually download the PyTorch pre-trained model introduced in `torchvision' library or if you have connected to the Internet, you can automatically downloaded them.\nThen, you can train the model for each dataset using the followling command.\n```\ncd src\npython train.py --gpu_id 0 --dataset coco --prefix resnet50_hashnet --bit 48 --net ResNet50 --lr 0.0003 --class_num 1.0\n```\nYou can set the command parameters to switch between different experiments. \n- \"gpu_id\" is the GPU ID to run experiments.\n- \"bit\" parameter is the number of bits of the hash codes.\n- \"dataset\" is the dataset selection. In our experiments, it can be \"imagenet\", \"nus_wide\" or \"coco\".\n- \"prefix\" is the path to output model snapshot and log file in \"snapshot\" directory.\n- \"net\" sets the base network. For details of setting, you can see network.py.\n    - For AlexNet, \"net\" is AlexNet.    \n    - For VGG Net, \"net\" is like VGG16. Detail names are in network.py.\n    - For ResNet, \"net\" is like ResNet50. Detail names are in network.py.\n- \"lr\" is the learning rate.\n- \"class_num\" is the positive and negative pairs balance weight.\n\n## Evaluation\nYou can evaluate the Mean Average Precision(MAP) result on each dataset using the followling command.\n```\ncd src\npython test.py --gpu_id 0 --dataset coco --prefix resnet50_hashnet --bit 48 --snapshot iter_10000\n```\nYou can set the command parameters to switch between different experiments. \n- \"gpu_id\" is the GPU ID to run experiments.\n- \"bit\" parameter is the number of bits of the hash codes.\n- \"dataset\" is the dataset selection. In our experiments, it can be \"imagenet\", \"nus_wide\" or \"coco\".\n- \"prefix\" is the path to output model snapshot and log file in \"snapshot\" directory.\n- \"snapshot\" is the snapshot model name. \"iter_09000\" means the model snapshoted at iteration 9000.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenshen03%2Fdeephash-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchenshen03%2Fdeephash-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenshen03%2Fdeephash-pytorch/lists"}