Commit 13ff79ef authored by spmohanty's avatar spmohanty

Update helper scripts

parent ad10db9a
[{"id": 1565,
"name": "bread-wholemeal",
"name_readable": "Bread, wholemeal",
"supercategory": "food"},
{"id": 1010,
"name": "potatoes-steamed",
"name_readable": "Potatoes steamed",
"supercategory": "food"},
{"id": 1085,
"name": "broccoli",
"name_readable": "Broccoli",
"supercategory": "food"},
{"id": 2053,
"name": "butter",
"name_readable": "Butter",
"supercategory": "food"},
{"id": 1310,
"name": "hard-cheese",
"name_readable": "Hard cheese",
"supercategory": "food"},
{"id": 2578,
"name": "water",
"name_readable": "Water",
"supercategory": "food"},
{"id": 1154,
"name": "banana",
"name_readable": "Banana",
"supercategory": "food"},
{"id": 2620,
"name": "wine-white",
"name_readable": "Wine, white",
"supercategory": "food"},
{"id": 1566,
"name": "bread-white",
"name_readable": "Bread, white",
"supercategory": "food"},
{"id": 1151,
"name": "apple",
"name_readable": "Apple",
"supercategory": "food"},
{"id": 2939,
"name": "pizza-margherita-baked",
"name_readable": "Pizza, Margherita, baked",
"supercategory": "food"},
{"id": 1040,
"name": "salad-leaf-salad-green",
"name_readable": "Salad, leaf / salad, green",
"supercategory": "food"},
{"id": 1070,
"name": "zucchini",
"name_readable": "Zucchini",
"supercategory": "food"},
{"id": 2580,
"name": "water-mineral",
"name_readable": "Water, mineral",
"supercategory": "food"},
{"id": 2512,
"name": "coffee-with-caffeine",
"name_readable": "Coffee, with caffeine",
"supercategory": "food"},
{"id": 1056,
"name": "avocado",
"name_readable": "Avocado",
"supercategory": "food"},
{"id": 1069,
"name": "tomato",
"name_readable": "Tomato",
"supercategory": "food"},
{"id": 2131,
"name": "dark-chocolate",
"name_readable": "Dark chocolate",
"supercategory": "food"},
{"id": 2521,
"name": "white-coffee-with-caffeine",
"name_readable": "White coffee, with caffeine",
"supercategory": "food"},
{"id": 2022, "name": "egg", "name_readable": "Egg", "supercategory": "food"},
{"id": 1026,
"name": "mixed-salad-chopped-without-sauce",
"name_readable": "Mixed salad (chopped without sauce)",
"supercategory": "food"},
{"id": 1068,
"name": "sweet-pepper",
"name_readable": "Sweet pepper",
"supercategory": "food"},
{"id": 1022,
"name": "mixed-vegetables",
"name_readable": "Mixed vegetables",
"supercategory": "food"},
{"id": 2750,
"name": "mayonnaise",
"name_readable": "Mayonnaise",
"supercategory": "food"},
{"id": 1468,
"name": "rice",
"name_readable": "Rice",
"supercategory": "food"},
{"id": 1013,
"name": "chips-french-fries",
"name_readable": "Chips, french fries",
"supercategory": "food"},
{"id": 1078,
"name": "carrot",
"name_readable": "Carrot",
"supercategory": "food"},
{"id": 2738,
"name": "tomato-sauce",
"name_readable": "Tomato sauce",
"supercategory": "food"},
{"id": 1061,
"name": "cucumber",
"name_readable": "Cucumber",
"supercategory": "food"},
{"id": 2618,
"name": "wine-red",
"name_readable": "Wine, red",
"supercategory": "food"},
{"id": 1311,
"name": "cheese",
"name_readable": "Cheese",
"supercategory": "food"},
{"id": 1163,
"name": "strawberries",
"name_readable": "Strawberries",
"supercategory": "food"},
{"id": 2504,
"name": "espresso-with-caffeine",
"name_readable": "Espresso, with caffeine",
"supercategory": "food"},
{"id": 2498, "name": "tea", "name_readable": "Tea", "supercategory": "food"},
{"id": 1788,
"name": "chicken",
"name_readable": "Chicken",
"supercategory": "food"},
{"id": 2099, "name": "jam", "name_readable": "Jam", "supercategory": "food"},
{"id": 1032,
"name": "leaf-spinach",
"name_readable": "Leaf spinach",
"supercategory": "food"},
{"id": 1505,
"name": "pasta-spaghetti",
"name_readable": "Pasta, spaghetti",
"supercategory": "food"},
{"id": 1058,
"name": "french-beans",
"name_readable": "French beans",
"supercategory": "food"},
{"id": 1554,
"name": "bread-whole-wheat",
"name_readable": "Bread, whole wheat",
"supercategory": "food"}]
#!/bin/bash #!/bin/bash
docker build -t $IMAGE_NAME docker build -t $IMAGE_NAME .
File mode changed from 100644 to 100755
...@@ -15,15 +15,12 @@ from mmdet.models import build_detector ...@@ -15,15 +15,12 @@ from mmdet.models import build_detector
import glob import glob
import json import json
test_images_path = os.getenv("AICROWD_TEST_IMAGES_PATH", False) TEST_IMAGES_PATH = os.getenv("AICROWD_TEST_IMAGES_PATH", False)
# Build a sample test_annotations file
annotations = {'categories': [], 'info': {}, 'images': []} annotations = {'categories': [], 'info': {}, 'images': []}
for item in glob.glob(TEST_IMAGES_PATH+'/*.jpg'):
for item in glob.glob(test_images_path+'/*.jpg'):
image_dict = dict() image_dict = dict()
img = mmcv.imread(item) img = mmcv.imread(item)
height,width,__ = img.shape height,width,__ = img.shape
id = int(os.path.basename(item).split('.')[0]) id = int(os.path.basename(item).split('.')[0])
...@@ -32,158 +29,8 @@ for item in glob.glob(test_images_path+'/*.jpg'): ...@@ -32,158 +29,8 @@ for item in glob.glob(test_images_path+'/*.jpg'):
image_dict['width'] = width image_dict['width'] = width
image_dict['height'] = height image_dict['height'] = height
annotations['images'].append(image_dict) annotations['images'].append(image_dict)
annotations['categories'] = [{'id': 1565, annotations['categories'] = json.loads(open("all_categories.json").read())
'name': 'bread-wholemeal', json.dump(annotations, open('test_annotations.json', 'w'))
'name_readable': 'Bread, wholemeal',
'supercategory': 'food'},
{'id': 1010,
'name': 'potatoes-steamed',
'name_readable': 'Potatoes steamed',
'supercategory': 'food'},
{'id': 1085,
'name': 'broccoli',
'name_readable': 'Broccoli',
'supercategory': 'food'},
{'id': 2053,
'name': 'butter',
'name_readable': 'Butter',
'supercategory': 'food'},
{'id': 1310,
'name': 'hard-cheese',
'name_readable': 'Hard cheese',
'supercategory': 'food'},
{'id': 2578,
'name': 'water',
'name_readable': 'Water',
'supercategory': 'food'},
{'id': 1154,
'name': 'banana',
'name_readable': 'Banana',
'supercategory': 'food'},
{'id': 2620,
'name': 'wine-white',
'name_readable': 'Wine, white',
'supercategory': 'food'},
{'id': 1566,
'name': 'bread-white',
'name_readable': 'Bread, white',
'supercategory': 'food'},
{'id': 1151,
'name': 'apple',
'name_readable': 'Apple',
'supercategory': 'food'},
{'id': 2939,
'name': 'pizza-margherita-baked',
'name_readable': 'Pizza, Margherita, baked',
'supercategory': 'food'},
{'id': 1040,
'name': 'salad-leaf-salad-green',
'name_readable': 'Salad, leaf / salad, green',
'supercategory': 'food'},
{'id': 1070,
'name': 'zucchini',
'name_readable': 'Zucchini',
'supercategory': 'food'},
{'id': 2580,
'name': 'water-mineral',
'name_readable': 'Water, mineral',
'supercategory': 'food'},
{'id': 2512,
'name': 'coffee-with-caffeine',
'name_readable': 'Coffee, with caffeine',
'supercategory': 'food'},
{'id': 1056,
'name': 'avocado',
'name_readable': 'Avocado',
'supercategory': 'food'},
{'id': 1069,
'name': 'tomato',
'name_readable': 'Tomato',
'supercategory': 'food'},
{'id': 2131,
'name': 'dark-chocolate',
'name_readable': 'Dark chocolate',
'supercategory': 'food'},
{'id': 2521,
'name': 'white-coffee-with-caffeine',
'name_readable': 'White coffee, with caffeine',
'supercategory': 'food'},
{'id': 2022, 'name': 'egg', 'name_readable': 'Egg', 'supercategory': 'food'},
{'id': 1026,
'name': 'mixed-salad-chopped-without-sauce',
'name_readable': 'Mixed salad (chopped without sauce)',
'supercategory': 'food'},
{'id': 1068,
'name': 'sweet-pepper',
'name_readable': 'Sweet pepper',
'supercategory': 'food'},
{'id': 1022,
'name': 'mixed-vegetables',
'name_readable': 'Mixed vegetables',
'supercategory': 'food'},
{'id': 2750,
'name': 'mayonnaise',
'name_readable': 'Mayonnaise',
'supercategory': 'food'},
{'id': 1468,
'name': 'rice',
'name_readable': 'Rice',
'supercategory': 'food'},
{'id': 1013,
'name': 'chips-french-fries',
'name_readable': 'Chips, french fries',
'supercategory': 'food'},
{'id': 1078,
'name': 'carrot',
'name_readable': 'Carrot',
'supercategory': 'food'},
{'id': 2738,
'name': 'tomato-sauce',
'name_readable': 'Tomato sauce',
'supercategory': 'food'},
{'id': 1061,
'name': 'cucumber',
'name_readable': 'Cucumber',
'supercategory': 'food'},
{'id': 2618,
'name': 'wine-red',
'name_readable': 'Wine, red',
'supercategory': 'food'},
{'id': 1311,
'name': 'cheese',
'name_readable': 'Cheese',
'supercategory': 'food'},
{'id': 1163,
'name': 'strawberries',
'name_readable': 'Strawberries',
'supercategory': 'food'},
{'id': 2504,
'name': 'espresso-with-caffeine',
'name_readable': 'Espresso, with caffeine',
'supercategory': 'food'},
{'id': 2498, 'name': 'tea', 'name_readable': 'Tea', 'supercategory': 'food'},
{'id': 1788,
'name': 'chicken',
'name_readable': 'Chicken',
'supercategory': 'food'},
{'id': 2099, 'name': 'jam', 'name_readable': 'Jam', 'supercategory': 'food'},
{'id': 1032,
'name': 'leaf-spinach',
'name_readable': 'Leaf spinach',
'supercategory': 'food'},
{'id': 1505,
'name': 'pasta-spaghetti',
'name_readable': 'Pasta, spaghetti',
'supercategory': 'food'},
{'id': 1058,
'name': 'french-beans',
'name_readable': 'French beans',
'supercategory': 'food'},
{'id': 1554,
'name': 'bread-whole-wheat',
'name_readable': 'Bread, whole wheat',
'supercategory': 'food'}]
json.dump(annotations, open('test.json', 'w'))
def single_gpu_test(model, data_loader, show=False): def single_gpu_test(model, data_loader, show=False):
...@@ -318,8 +165,8 @@ def main(): ...@@ -318,8 +165,8 @@ def main():
torch.backends.cudnn.benchmark = True torch.backends.cudnn.benchmark = True
cfg.model.pretrained = None cfg.model.pretrained = None = True = True = 'test.json' = 'test_annotations.json' = test_images_path = TEST_IMAGES_PATH
# init distributed env first, since logger depends on the dist info. # init distributed env first, since logger depends on the dist info.
if args.launcher == 'none': if args.launcher == 'none':
#!/bin/bash #!/bin/bash
python tools/ configs/ models/epoch_22.pth --json_out $AICROWD_PREDICTIONS_OUTPUT_PATH python configs/ models/epoch_22.pth --json_out $AICROWD_PREDICTIONS_OUTPUT_PATH
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment