-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Open
Description
您好,RV1106板端内存资源有限,运行会报OOM的错误,因此,我尝试打包检测和识别模型到Light_RV1106,替换Gundam_RV1106,但是在运行时报了如下错误:
[simple_archive.h][48]: Invalid archive file: -2
[launch.cpp][44]: Failed to load resources
Load Model error: 1361
我构建archive的工具如下(官方提供的脚本):
import os
import tarfile
import click
import tqdm
def remove_suffix(filename):
"""Remove the file suffix."""
return os.path.splitext(filename)[0]
@click.command()
@click.argument('folder_path')
@click.argument('output_filename')
@click.option('--rm-suffix', is_flag=True, default=True, help='Remove file suffixes in the archive.')
def make_tar(folder_path, output_filename, rm_suffix):
"""
Package the specified folder into a tar file. FOLDER_PATH is the path to the folder to be packaged,
and OUTPUT_FILENAME is the name of the output tar file.
"""
# Collect all files to be packed for printing their info before packaging
files_to_pack = []
for root, dirs, files in os.walk(folder_path):
for file in files:
file_path = os.path.join(root, file)
arcname = os.path.relpath(file_path, start=folder_path)
if rm_suffix:
# Split the file name and directory name
dirs, filename = os.path.split(arcname)
# Remove the file suffix
filename = remove_suffix(filename)
# Reassemble the directory and the processed file name
arcname = os.path.join(dirs, filename)
files_to_pack.append((file_path, arcname))
# Print file information before packing
print("Printing file information before packaging...")
for file_path, arcname in files_to_pack:
file_size_kb = os.path.getsize(file_path) / 1024 # Convert size to kilobytes
print(f"File: {arcname}, Size: {file_size_kb:.2f} KB")
# Package the files
with tarfile.open(output_filename, "w") as tar:
print("Packing....")
for file_path, arcname in tqdm.tqdm(files_to_pack):
tar.add(file_path, arcname=arcname)
if name == 'main':
make_tar()
Metadata
Metadata
Assignees
Labels
No labels