Comments (1)
@rtaori
Unfortunately, we don't have a plan to update our codebase now.
I can share the label map extraction code snippet, but I'm not sure whether this is the right and valid code.
I hope you can understand how the label maps were extracted through this code, but if you want fully-working codes, please wait for our next codebase update.
normalize = torchvision.transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
)
train_root = os.path.join(data_path, 'train')
train_dataset = ImageFolderWithPath(
root=train_root,
transform=torchvision.transforms.Compose([
torchvision.transforms.Resize((machine_annotator_image_size,
machine_annotator_image_size)),
torchvision.transforms.ToTensor(),
normalize,
]))
train_sampler = torch.utils.data.distributed.DistributedSampler(
train_dataset)
train_loader = torch.utils.data.DataLoader(
train_dataset,
batch_sizebatch_size,
shuffle=False,
num_workers=machine_annotator_num_workers,
pin_memory=True,
sampler=train_sampler
)
score_maps = {}
print('Train loader size: {}'.format(len(train_loader)))
for iteration, batch in enumerate(train_loader):
start_time = time.time()
input, target, img_names = batch
target = target.cuda()
with torch.no_grad():
# get score_map by removing GlobalAvergaPool. (See Appendix)
output_map = machine_annotator_model(input, score_map=True)
output_topk = output_map.topk(k=machine_annotator_topk, dim=1)
for idx, (t0, t1) in enumerate(zip(output_topk[0], output_topk[1])):
img_name = img_names[idx].split('/')[-1].split('.')[0]
t = torch.cat([t0.unsqueeze(0), t1.unsqueeze(0).float()],
dim=0)
score_maps[img_name] = t.cpu()
score_map_path = '{}_{}_sz{}_top{}_score_maps.pt'.format(
data.dataset,
machine_annotator_arch,
machine_annotator_image_size,
machine_annotator_topk)
from relabel_imagenet.
Related Issues (13)
- Relabel data HOT 6
- Dataset Downloading HOT 4
- ImageNet of Validation HOT 3
- Crop Coordinate Calculation. HOT 1
- LabelPooling in 4.3 Multi-Label Classification HOT 1
- infer HOT 1
- Relabling on cutmix ? HOT 5
- About the optimizers and hyper-parameters HOT 3
- Reproduce resnet 18 + relabel HOT 5
- about dataset download HOT 2
- about relabel dataset HOT 3
- How to relabel imagenet? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from relabel_imagenet.