Commit 2ae86e48 authored by Sikhin VC's avatar Sikhin VC

initial commit

parent a0413783
...@@ -14,7 +14,7 @@ class ModelOptimization: ...@@ -14,7 +14,7 @@ class ModelOptimization:
logger.info(f"Provided number of classes and image size are : {self.num_class} and {self.image_size}") logger.info(f"Provided number of classes and image size are : {self.num_class} and {self.image_size}")
try: try:
with open('yolov5/yololayer.h', 'r') as file: with open('/app/edge_engine/yolov5/yololayer.h', 'r') as file:
# read a list of lines into data # read a list of lines into data
data = file.readlines() data = file.readlines()
...@@ -23,7 +23,7 @@ class ModelOptimization: ...@@ -23,7 +23,7 @@ class ModelOptimization:
data[21] = f" static constexpr int INPUT_W = {self.image_size};\n" data[21] = f" static constexpr int INPUT_W = {self.image_size};\n"
# and write everything back # and write everything back
with open('yolov5/yololayer.h', 'w') as file: with open('/app/edge_engine/yolov5/yololayer.h', 'w') as file:
file.writelines(data) file.writelines(data)
logger.info("Successfully changed configurations") logger.info("Successfully changed configurations")
except Exception as e: except Exception as e:
...@@ -37,16 +37,16 @@ class ModelOptimization: ...@@ -37,16 +37,16 @@ class ModelOptimization:
logger.info(f"Current directory is : {current_directory}") logger.info(f"Current directory is : {current_directory}")
build_path = os.path.join(current_directory, "yolov5", "build") build_path = os.path.join(current_directory, "yolov5", "build")
if os.path.isdir('yolov5/build'): if os.path.isdir('/app/edge_engine/yolov5/build'):
logger.info("build directory exists. Removing build directory!!") logger.info("build directory exists. Removing build directory!!")
shutil.rmtree('yolov5/build') shutil.rmtree('/app/edge_engine/yolov5/build')
os.mkdir(build_path) os.mkdir(build_path)
weight_name_with_extension = os.path.basename(self.weight_path) weight_name_with_extension = os.path.basename(self.weight_path)
weight_name, extension = os.path.splitext(weight_name_with_extension) weight_name, extension = os.path.splitext(weight_name_with_extension)
src = f"{current_directory}/yolov5/build/" src = "/app/edge_engine/yolov5/build"
shutil.copy(self.weight_path, src) shutil.copy(self.weight_path, src)
logger.info(f"Created build folder") logger.info(f"Created build folder")
os.chdir('yolov5/build') os.chdir('/app/edge_engine/yolov5/build')
logger.info("Running CMake command") logger.info("Running CMake command")
subprocess.run(['cmake', '..']) subprocess.run(['cmake', '..'])
logger.info("Running Make command") logger.info("Running Make command")
......
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