Commit b582459a authored by nikhil_rayaprolu's avatar nikhil_rayaprolu
Browse files

fixing the errors during build

parent 4879c989
......@@ -60,7 +60,8 @@ RUN export uid=${HOST_UID} gid=${HOST_GID} && \
USER ${USER_NAME}
WORKDIR ${HOME_DIR}
COPY ./requirements.txt .
RUN pip install -r requirements.txt --user
COPY . .
RUN sudo chown ${HOST_UID}:${HOST_GID} -R *
......
#!/usr/bin/env python
import aicrowd_api
import os
########################################################################
# Instatiate Event Notifier
########################################################################
aicrowd_events = aicrowd_api.events.AIcrowdEvents()
def execution_start():
########################################################################
# Register Evaluation Start event
########################################################################
aicrowd_events.register_event(
event_type=aicrowd_events.AICROWD_EVENT_INFO,
message="execution_started",
payload={ #Arbitrary Payload
"event_type": "food_recognition_challenge:execution_started"
}
)
def execution_progress(progress_payload):
image_ids = progress_payload["image_ids"]
########################################################################
# Register Evaluation Progress event
########################################################################
aicrowd_events.register_event(
event_type=aicrowd_events.AICROWD_EVENT_INFO,
message="execution_progress",
payload={ #Arbitrary Payload
"event_type": "food_recognition_challenge:execution_progress",
"image_ids" : image_ids
}
)
def execution_success(payload):
predictions_output_path = payload["predictions_output_path"]
########################################################################
# Register Evaluation Complete event
########################################################################
expected_output_path = os.getenv("AICROWD_PREDICTIONS_OUTPUT_PATH", False)
if expected_output_path != predictions_output_path:
raise Exception("Please write the output to the path specified in the environment variable : AICROWD_PREDICTIONS_OUTPUT_PATH instead of {}".format(predictions_output_path))
aicrowd_events.register_event(
event_type=aicrowd_events.AICROWD_EVENT_SUCCESS,
message="execution_success",
payload={ #Arbitrary Payload
"event_type": "food_recognition_challenge:execution_success",
"predictions_output_path" : predictions_output_path
},
blocking=True
)
def execution_error(error):
########################################################################
# Register Evaluation Complete event
########################################################################
aicrowd_events.register_event(
event_type=aicrowd_events.AICROWD_EVENT_ERROR,
message="execution_error",
payload={ #Arbitrary Payload
"event_type": "food_recognition_challenge:execution_error",
"error" : error
},
blocking=True
)
#!/bin/bash
docker build -t $IMAGE_NAME .
\ No newline at end of file
docker run -it \
--net=host \
-v ${TEST_IMAGES_PATH}:/test_images \
-v /tmp:/tmp_host \
-e AICROWD_IS_GRADING=True \
-e AICROWD_TEST_IMAGES_PATH="/test_images" \
-e AICROWD_PREDICTIONS_OUTPUT_PATH="/tmp/output.json" \
$IMAGE_NAME \
/home/aicrowd/run.sh
......@@ -43,7 +43,7 @@ from mrcnn import model as modellib, utils
PRETRAINED_MODEL_PATH = os.path.join(ROOT_DIR,"final_model.h5")
LOGS_DIRECTORY = os.path.join(ROOT_DIR, "logs")
MODEL_DIR = os.path.join(ROOT_DIR, "logs")
IMAGE_DIR = os.path.join(ROOT_DIR, "data", "test_images")
# IMAGE_DIR = os.path.join(ROOT_DIR, "data", "test")
class InferenceConfig(coco.CocoConfig):
......@@ -72,13 +72,8 @@ model_path = PRETRAINED_MODEL_PATH
model.load_weights(model_path, by_name=True)
class_names = ['BG', 'bread-wholemeal', ' potatoes-steamed', ' broccoli', ' butter', ' hard-cheese', ' water', ' banana', ' wine-white', ' bread-white', ' apple', ' pizza-margherita-baked', ' salad-leaf-salad-green', ' zucchini', ' water-mineral', ' coffee-with-caffeine', ' avocado', ' tomato', ' dark-chocolate', ' white-coffee-with-caffeine', ' egg', ' mixed-salad-chopped-without-sauce', ' sweet-pepper', ' mixed-vegetables', ' mayonnaise', ' rice', ' chips-french-fries', ' carrot', ' tomato-sauce', ' cucumber', ' wine-red', ' cheese', ' strawberries', ' espresso-with-caffeine', ' tea', ' chicken', ' jam', ' leaf-spinach', ' pasta-spaghetti', ' french-beans', ' bread-whole-wheat'] # In our case, we have 1 class for the background, and 1 class for building
file_names = next(os.walk(IMAGE_DIR))[2]
TRAIN_ANNOTATIONS_PATH = "data/train/annotation.json"
coco = COCO(TRAIN_ANNOTATIONS_PATH)
category_ids = coco.loadCats(coco.getCatIds())
id_category = [_["id"] for _ in category_ids]
id_category = [0] + id_category
id_category = [0, 1565, 1010, 1085, 2053, 1310, 2578, 1154, 2620, 1566, 1151, 2939, 1040, 1070, 2580, 2512, 1056, 1069, 2131, 2521, 2022, 1026, 1068, 1022, 2750, 1468, 1013, 1078, 2738, 1061, 2618, 1311, 1163, 2504, 2498, 1788, 2099, 1032, 1505, 1058, 1554]
......
#!/bin/bash
pip install -r requirements.txt
python3 run.py
\ No newline at end of file
python3 run.py
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