charlie880624 7716a0060f
Some checks failed
deploy / build-n-publish (push) Has been cancelled
lint / lint (push) Has been cancelled
build / build_cpu (3.7, 1.5.1, torch1.5, 0.6.1) (push) Has been cancelled
build / build_cpu (3.7, 1.6.0, torch1.6, 0.7.0) (push) Has been cancelled
build / build_cpu (3.7, 1.7.0, torch1.7, 0.8.1) (push) Has been cancelled
build / build_cpu (3.7, 1.8.0, torch1.8, 0.9.0) (push) Has been cancelled
build / build_cpu (3.7, 1.9.0, torch1.9, 0.10.0) (push) Has been cancelled
build / build_cuda101 (3.7, 1.5.1+cu101, torch1.5, 0.6.1+cu101) (push) Has been cancelled
build / build_cuda101 (3.7, 1.6.0+cu101, torch1.6, 0.7.0+cu101) (push) Has been cancelled
build / build_cuda101 (3.7, 1.7.0+cu101, torch1.7, 0.8.1+cu101) (push) Has been cancelled
build / build_cuda101 (3.7, 1.8.0+cu101, torch1.8, 0.9.0+cu101) (push) Has been cancelled
build / build_cuda102 (3.6, 1.9.0+cu102, torch1.9, 0.10.0+cu102) (push) Has been cancelled
build / build_cuda102 (3.7, 1.9.0+cu102, torch1.9, 0.10.0+cu102) (push) Has been cancelled
build / build_cuda102 (3.8, 1.9.0+cu102, torch1.9, 0.10.0+cu102) (push) Has been cancelled
build / build_cuda102 (3.9, 1.9.0+cu102, torch1.9, 0.10.0+cu102) (push) Has been cancelled
build / test_windows (windows-2022, cpu, 3.8) (push) Has been cancelled
build / test_windows (windows-2022, cu111, 3.8) (push) Has been cancelled
feat: add golf dataset, kneron configs, and tools
- Add golf1/2/4/7/8 dataset classes for semantic segmentation
- Add kneron-specific configs (meconfig series, kn_stdc1_golf4class)
- Organize scripts into tools/check/ and tools/kneron/
- Add kneron_preprocessing module
- Update README with quick-start guide
- Update .gitignore to exclude data dirs, onnx, nef outputs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 13:14:30 +08:00

60 lines
1.7 KiB
Python

from abc import ABCMeta, abstractmethod
class Param_base(object):
@abstractmethod
def update(self,**dic):
raise NotImplementedError("Must override")
def load_dic(self, key, **dic):
if key in dic:
param = eval('self.'+key)
param = dic[key]
def __str__(self):
str_out = []
return(' '.join(str_out))
class Common(Param_base):
print_info = False
model_size = [0,0]
numerical_type = 'floating'
def update(self, **dic):
self.print_info = dic['print_info']
self.model_size = dic['model_size']
self.numerical_type = dic['numerical_type']
def __str__(self):
str_out = ['numerical_type:',str(self.numerical_type)]
return(' '.join(str_out))
class Runner_base(metaclass=ABCMeta):
common = Common()
general = Param_base()
floating = Param_base()
hw = Param_base()
def update(self, **kwargs):
## update param
self.common.update(**kwargs['common'])
self.general.update(**kwargs['general'])
assert(self.common.numerical_type.lower() in ['floating', '520', '720'])
if (self.common.numerical_type == 'floating'):
if (self.floating.__class__.__name__ != 'Param_base'):
self.floating.update(**kwargs['floating'])
else:
if (self.hw.__class__.__name__ != 'Param_base'):
self.hw.update(**kwargs['hw'])
def print_info(self):
if (self.common.numerical_type == 'floating'):
print(self, self.common, self.general, self.floating)
else:
print(self, self.common, self.general, self.hw)