3/24/2023 0 Comments Define anaconda for mac出现如下报错信息: Traceback (most recent call last):įile "e:\PythonProject\DDAG_mindspore\train_ddag.py", line 284, in įile "D:\ProgramData\Anaconda3\envs\mindspore_cpu\lib\site-packages\mindspore\train\model.py", lineĭataset_size = train_dataset.get_dataset_size()įile "D:\ProgramData\Anaconda3\envs\mindspore_cpu\lib\site-packages\mindspore\dataset\engine\datasets.py", line 1455, in get_dataset_size Model = Model(net, loss_fn=criterion1, optimizer=optimizer_P, metrics=None) Operations=transform_train, input_columns= 在GeneratorDataset中使用自定义的Sampler,具体如下: trainset = ds.GeneratorDataset(trainset_generator,, sampler=sampler).map( 在CPU MindSpore1.1.1进行定义如下自定义Sampler: 1 class IdentitySampler(ds.Sampler):ģ """Sample person identities evenly in each batch.ħ train_color_label, train_thermal_label: labels of two modalitiesĩ color_pos, thermal_pos: positions of each identityġ6 def _init_(self, train_color_label, train_thermal_label, color_pos, thermal_pos, num_pos, batchSize, epoch):ġ8 uni_label = np.unique(train_color_label)Ģ2 N = np.maximum(len(train_color_label), len(train_thermal_label))Ģ4 for j in range(int(N/(batchSize*num_pos)) 1):Ģ6 batch_idx = np.random.choice(uni_label, batchSize, replace = False)ģ0 sample_color = np.random.choice(color_pos, num_pos)ģ2 sample_thermal = np.random.choice(thermal_pos, num_pos)Ĥ2 index1 = np.hstack((index1, sample_color))Ĥ4 index2 = np.hstack((index2, sample_thermal))ĥ6 # return iter(np.arange(len(self.index1)))
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |