cleanup add training bell
This commit is contained in:
36
backend/routes/api.py
Normal file → Executable file
36
backend/routes/api.py
Normal file → Executable file
@@ -90,9 +90,11 @@ def start_yolox_training():
|
||||
details_id = training.project_details_id
|
||||
|
||||
# Step 1: Generate COCO JSON files
|
||||
# IMPORTANT: Pass training_id (not details_id) so JSON files are generated
|
||||
# in the same location where exp.py expects them
|
||||
from services.generate_json_yolox import generate_training_json
|
||||
print(f'Generating COCO JSON for training {training_id}...')
|
||||
generate_training_json(details_id)
|
||||
generate_training_json(training_id)
|
||||
|
||||
# Step 2: Generate exp.py
|
||||
from services.generate_yolox_exp import save_yolox_exp
|
||||
@@ -157,8 +159,9 @@ def start_yolox_training():
|
||||
venv_activate = yolox_venv
|
||||
cmd = f'cmd /c ""{venv_activate}" && python tools\\train.py {train_args}"'
|
||||
else:
|
||||
# Linux: Use bash with source
|
||||
cmd = f'bash -c "source {yolox_venv} && python tools/train.py {train_args}"'
|
||||
# Linux: Use bash with source to activate the venv
|
||||
venv_activate = os.path.join(yolox_venv, 'bin', 'activate')
|
||||
cmd = f'bash -c "source {venv_activate} && python tools/train.py {train_args}"'
|
||||
|
||||
print(f'Training command: {cmd}')
|
||||
|
||||
@@ -496,17 +499,26 @@ def yolox_settings():
|
||||
settings['activation'] = settings['act']
|
||||
del settings['act']
|
||||
|
||||
# Type conversions
|
||||
numeric_fields = [
|
||||
'max_epoch', 'depth', 'width', 'warmup_epochs', 'warmup_lr',
|
||||
'no_aug_epochs', 'min_lr_ratio', 'weight_decay', 'momentum',
|
||||
'print_interval', 'eval_interval', 'test_conf', 'nmsthre',
|
||||
'multiscale_range', 'degrees', 'translate', 'shear',
|
||||
'train', 'valid', 'test'
|
||||
# Type conversions - Integer fields
|
||||
integer_fields = [
|
||||
'max_epoch', 'warmup_epochs', 'no_aug_epochs', 'print_interval',
|
||||
'eval_interval', 'multiscale_range', 'data_num_workers', 'num_classes'
|
||||
]
|
||||
|
||||
for field in numeric_fields:
|
||||
if field in settings:
|
||||
for field in integer_fields:
|
||||
if field in settings and settings[field] not in [None, '']:
|
||||
settings[field] = int(float(settings[field])) # Convert via float to handle "10.0" strings
|
||||
|
||||
# Type conversions - Float fields
|
||||
float_fields = [
|
||||
'depth', 'width', 'warmup_lr', 'min_lr_ratio', 'weight_decay',
|
||||
'momentum', 'test_conf', 'nmsthre', 'degrees', 'translate',
|
||||
'shear', 'mosaic_prob', 'mixup_prob', 'hsv_prob', 'flip_prob',
|
||||
'basic_lr_per_img', 'train', 'valid', 'test'
|
||||
]
|
||||
|
||||
for field in float_fields:
|
||||
if field in settings and settings[field] not in [None, '']:
|
||||
settings[field] = float(settings[field])
|
||||
|
||||
# Boolean conversions
|
||||
|
||||
Reference in New Issue
Block a user