Beispiel #1
0
import json
import os
import torch
import pandas as pd
from skimage import io, transform
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import helpers_preprocess as labels
from PIL import Image
import matplotlib.pyplot as plt

(bad_detections_train, bad_detections_val, bad_detections_test) = \
    labels.dry_run()

# bad_detections_train,bad_detections_val,bad_detections_test=[],[],[]

NO_VERB = 29
NO_OBJ_CAT = 80

# def get_ambiguity_score(prior_mat, labels_all):

# def get_ambiguity_score(prior_mat, labels_all, labels_object):
#     labels_all_re = labels_all.reshape((labels_all.shape[0]*labels_all.shape[1], labels_all.shape[2]))
#     verb_prior = np.zeros((NO_VERB, NO_OBJ_CAT))
#     ambiguity_score = np.zeros((labels_object.shape[0], NO_VERB))
#     for c in range(NO_OBJ_CAT):
#         for w in range(NO_VERB):
#             cnt = 0
Beispiel #2
0
from __future__ import print_function, division
import json
import os
import torch
import pandas as pd
from skimage import io, transform
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import helpers_preprocess as labels
from PIL import Image

bad_detections_train, bad_detections_val, bad_detections_test = labels.dry_run(
)
# bad_detections_train,bad_detections_val,bad_detections_test=[],[],[]
NO_VERB = 29


def vcoco_collate(batch):
    image_id = []
    action_label = []
    for index, item in enumerate(batch):
        image_id.append(torch.tensor(int(item['image_id'])))

        action_label.append(torch.tensor(item['action_label']))

    return [torch.stack(image_id), torch.stack(action_label)]


class Rescale(object):
Beispiel #3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import json
import os
import torch
import pandas as pd
from skimage import io, transform
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import helpers_preprocess as labels
from PIL import Image

(bad_detections_train, bad_detections_test) = labels.dry_run()

# bad_detections_train,bad_detections_val,bad_detections_test=[],[],[]

NO_VERB = 117
NO_OBJ_CAT = 80


def get_ambiguity_score(prior_mat, labels_all, labels_object):
    labels_all_re = labels_all.reshape(
        (labels_all.shape[0] * labels_all.shape[1], labels_all.shape[2]))
    verb_prior = np.zeros((NO_VERB, NO_OBJ_CAT))
    ambiguity_score = np.zeros((labels_object.shape[0], NO_VERB))
    for c in range(NO_OBJ_CAT):
        for w in range(NO_VERB):
            cnt = 0