mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-24 20:19:22 +01:00
Fix some words (#261)
This commit is contained in:
@@ -7,7 +7,7 @@ from modelscope.hub.snapshot_download import snapshot_download
|
||||
|
||||
|
||||
def subparser_func(args):
|
||||
""" Fuction which will be called for a specific sub parser.
|
||||
""" Function which will be called for a specific sub parser.
|
||||
"""
|
||||
return DownloadCMD(args)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ template_path = os.path.join(curren_path, 'template')
|
||||
|
||||
|
||||
def subparser_func(args):
|
||||
""" Fuction which will be called for a specific sub parser.
|
||||
""" Function which will be called for a specific sub parser.
|
||||
"""
|
||||
return ModelCardCMD(args)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ template_path = os.path.join(curren_path, 'template')
|
||||
|
||||
|
||||
def subparser_func(args):
|
||||
""" Fuction which will be called for a specific sub parser.
|
||||
""" Function which will be called for a specific sub parser.
|
||||
"""
|
||||
return PipelineCMD(args)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ plugins_manager = PluginsManager()
|
||||
|
||||
|
||||
def subparser_func(args):
|
||||
""" Fuction which will be called for a specific sub parser.
|
||||
""" Function which will be called for a specific sub parser.
|
||||
"""
|
||||
return PluginsCMD(args)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class ${model_name}(TorchModel):
|
||||
def init_model(self, **kwargs):
|
||||
"""Provide default implementation based on TorchModel and user can reimplement it.
|
||||
include init model and load ckpt from the model_dir, maybe include preprocessor
|
||||
if nothing to do, then return lambdx x: x
|
||||
if nothing to do, then return lambda x: x
|
||||
"""
|
||||
return lambda x: x
|
||||
|
||||
@@ -41,7 +41,7 @@ class ${preprocessor_name}(Preprocessor):
|
||||
|
||||
def init_preprocessor(self, **kwarg):
|
||||
""" Provide default implementation based on preprocess_cfg and user can reimplement it.
|
||||
if nothing to do, then return lambdx x: x
|
||||
if nothing to do, then return lambda x: x
|
||||
"""
|
||||
return lambda x: x
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class ModelForSequenceClassificationExporter(TorchModelExporter):
|
||||
outputs_origin = list(numpify_tensor_nested(outputs_origin))
|
||||
|
||||
outputs_origin = [outputs_origin[0]
|
||||
] # keeo `predictions`, drop other outputs
|
||||
] # keep `predictions`, drop other outputs
|
||||
|
||||
np_dummy_inputs = numpify_tensor_nested(dummy_inputs)
|
||||
np_dummy_inputs['label_mask'] = np_dummy_inputs['label_mask'].astype(
|
||||
|
||||
@@ -18,7 +18,7 @@ class FSMNUnit(nn.Module):
|
||||
Args:
|
||||
dimlinear: input / output dimension
|
||||
dimproj: fsmn input / output dimension
|
||||
lorder: left ofder
|
||||
lorder: left order
|
||||
rorder: right order
|
||||
"""
|
||||
super(FSMNUnit, self).__init__()
|
||||
|
||||
@@ -435,7 +435,7 @@ class FSMN(nn.Module):
|
||||
"""
|
||||
Args:
|
||||
input (torch.Tensor): Input tensor (B, T, D)
|
||||
in_cache(torhc.Tensor): (B, D, C), C is the accumulated cache size
|
||||
in_cache(torch.Tensor): (B, D, C), C is the accumulated cache size
|
||||
"""
|
||||
|
||||
# print("FSMN forward!!!!")
|
||||
|
||||
@@ -39,8 +39,8 @@ class FSMNDecorator(TorchModel):
|
||||
model_dir (str): the model path.
|
||||
cmvn_file (str): cmvn file
|
||||
backbone (dict): params related to backbone
|
||||
input_dim (int): input dimention of network
|
||||
output_dim (int): output dimention of network
|
||||
input_dim (int): input dimension of network
|
||||
output_dim (int): output dimension of network
|
||||
training (bool): training or inference mode
|
||||
"""
|
||||
super().__init__(model_dir, *args, **kwargs)
|
||||
@@ -108,7 +108,7 @@ class FSMNDecorator(TorchModel):
|
||||
class KWSModel(nn.Module):
|
||||
"""Our model consists of four parts:
|
||||
1. global_cmvn: Optional, (idim, idim)
|
||||
2. preprocessing: feature dimention projection, (idim, hdim)
|
||||
2. preprocessing: feature dimension projection, (idim, hdim)
|
||||
3. backbone: backbone or feature extractor of the whole network, (hdim, hdim)
|
||||
4. classifier: output layer or classifier of KWS model, (hdim, odim)
|
||||
5. activation:
|
||||
@@ -133,7 +133,7 @@ class KWSModel(nn.Module):
|
||||
odim (int): output dimension of network
|
||||
hdim (int): hidden dimension of network
|
||||
global_cmvn (nn.Module): cmvn for input feature, (idim, idim)
|
||||
preprocessing (nn.Module): feature dimention projection, (idim, hdim)
|
||||
preprocessing (nn.Module): feature dimension projection, (idim, hdim)
|
||||
backbone (nn.Module): backbone or feature extractor of the whole network, (hdim, hdim)
|
||||
classifier (nn.Module): output layer or classifier of KWS model, (hdim, odim)
|
||||
activation (nn.Module): nn.Identity for training, nn.Sigmoid for inference
|
||||
|
||||
@@ -871,7 +871,7 @@ class SwinTransformer2D_TPS(nn.Module):
|
||||
|
||||
Args:
|
||||
logger (logging.Logger): The logger used to print
|
||||
debugging infomation.
|
||||
debugging information.
|
||||
"""
|
||||
checkpoint = torch.load(self.pretrained, map_location='cpu')
|
||||
state_dict = checkpoint['model']
|
||||
|
||||
@@ -181,7 +181,7 @@ class BodyKeypointsDetection3D(TorchModel):
|
||||
"camera_pose": Tensor, [1, NUM_FRAME, OUT_NUM_JOINTS, OUT_3D_FEATURE_DIM],
|
||||
3D human pose keypoints in camera frame.
|
||||
"camera_traj": Tensor, [1, NUM_FRAME, 1, 3],
|
||||
root keypoints coordinates in camere frame.
|
||||
root keypoints coordinates in camera frame.
|
||||
"""
|
||||
inputs_2d = input['inputs_2d']
|
||||
pose2d_rr = input['pose2d_rr']
|
||||
|
||||
@@ -46,14 +46,14 @@ class DiGraph():
|
||||
super().__init__()
|
||||
self.num_nodes = len(skeleton.parents())
|
||||
self.directed_edges_hop1 = [
|
||||
(parrent, child)
|
||||
for child, parrent in enumerate(skeleton.parents()) if parrent >= 0
|
||||
(parent, child) for child, parent in enumerate(skeleton.parents())
|
||||
if parent >= 0
|
||||
]
|
||||
self.directed_edges_hop2 = [(0, 1, 2), (0, 4, 5), (0, 7, 8), (1, 2, 3),
|
||||
(4, 5, 6), (7, 8, 9),
|
||||
(7, 8, 11), (7, 8, 14), (8, 9, 10),
|
||||
(8, 11, 12), (8, 14, 15), (11, 12, 13),
|
||||
(14, 15, 16)] # (parrent, child)
|
||||
(14, 15, 16)] # (parent, child)
|
||||
self.directed_edges_hop3 = [(0, 1, 2, 3), (0, 4, 5, 6), (0, 7, 8, 9),
|
||||
(7, 8, 9, 10), (7, 8, 11, 12),
|
||||
(7, 8, 14, 15), (8, 11, 12, 13),
|
||||
@@ -112,8 +112,8 @@ class Graph():
|
||||
# edge is a list of [child, parent] paris
|
||||
self.num_node = len(skeleton.parents())
|
||||
self_link = [(i, i) for i in range(self.num_node)]
|
||||
neighbor_link = [(child, parrent)
|
||||
for child, parrent in enumerate(skeleton.parents())]
|
||||
neighbor_link = [(child, parent)
|
||||
for child, parent in enumerate(skeleton.parents())]
|
||||
self.self_link = self_link
|
||||
self.neighbor_link = neighbor_link
|
||||
self.edge = self_link + neighbor_link
|
||||
|
||||
@@ -94,7 +94,7 @@ class FaceAna():
|
||||
sorted_bboxes = [bboxes[x] for x in picked]
|
||||
return np.array(sorted_bboxes)
|
||||
|
||||
def judge_boxs(self, previuous_bboxs, now_bboxs):
|
||||
def judge_boxs(self, previous_bboxs, now_bboxs):
|
||||
|
||||
def iou(rec1, rec2):
|
||||
|
||||
@@ -116,17 +116,16 @@ class FaceAna():
|
||||
|
||||
return intersect / (sum_area - intersect)
|
||||
|
||||
if previuous_bboxs is None:
|
||||
if previous_bboxs is None:
|
||||
return now_bboxs
|
||||
|
||||
result = []
|
||||
|
||||
for i in range(now_bboxs.shape[0]):
|
||||
contain = False
|
||||
for j in range(previuous_bboxs.shape[0]):
|
||||
if iou(now_bboxs[i], previuous_bboxs[j]) > self.iou_thres:
|
||||
result.append(
|
||||
self.smooth(now_bboxs[i], previuous_bboxs[j]))
|
||||
for j in range(previous_bboxs.shape[0]):
|
||||
if iou(now_bboxs[i], previous_bboxs[j]) > self.iou_thres:
|
||||
result.append(self.smooth(now_bboxs[i], previous_bboxs[j]))
|
||||
contain = True
|
||||
break
|
||||
if not contain:
|
||||
|
||||
Reference in New Issue
Block a user