height,weight=map (float,input().split()) standard_weight = height-100 diff = weight-standard_weight if abs(diff) <= standard_weight*0.05: print("体重正常") else: print("体重超标" if diff > 0 else "体重不达表")

时间: 2024-03-04 13:53:55 浏览: 11
你的代码实现也是正确的,使用了`map()`函数来同时输入身高和体重,避免了多次输入的麻烦。而判断体重超标与体重不达标的方式,也很巧妙地使用了`if`语句的三元表达式。 不过需要注意的是,在判断体重是否在正负5%之间时,你的代码中用的是`standard_weight*0.05`,这里应该是标准体重的5%,即`standard_weight*0.05`,这里需要修改一下。
相关问题

class Lnput_lnitialization(): def __init__(self, top, Number_of_rows): self.top = top int(data_demo.window_width // 3.9875) int(data_demo.window_height // 1.138) self.frame = tk.Frame(self.top, bg='Black', highlightthickness=2, highlightbackground='Black') self.frame.place(relx=0.739, rely=0.083, width=int(data_demo.window_width // 3.87), height=int(data_demo.window_height // 1.15)) self.canvas = tk.Canvas(self.frame) self.canvas.place(relx=0, rely=0, width=int(data_demo.window_width // 3.9875), height=int(data_demo.window_height // 1.15)) scrollbar = tk.Scrollbar(self.frame, command=self.canvas.yview) scrollbar.pack(side="right", fill="y") self.canvas.configure(yscrollcommand=scrollbar.set) self.button_frame = tk.Frame(self.canvas, bg='Yellow') self.button_frame.pack_propagate(False) # 禁止自动调整大小 self.button_frame.pack(fill=BOTH, expand=True) # 使其自适应大小 self.canvas.create_window((0, 0), window=self.button_frame, anchor="nw") self.button_frame.columnconfigure(0, weight=1) self.button_frame.columnconfigure(1, weight=1) self.button_frame.columnconfigure(2, weight=1) self.button_frame.columnconfigure(3, weight=1) self.button_frame.columnconfigure(4, weight=1) self.button_frame.columnconfigure(5, weight=1) self.Content(Number_of_rows)为什么用不了滚轮了

这段代码中使用了tkinter的Canvas组件来创建一个可滚动的窗口,但是在代码中并没有对Canvas绑定滚轮事件的处理程序。因此,当鼠标滚轮事件发生时,Canvas并没有响应。解决方法是在代码中使用canvas.bind()方法绑定滚轮事件,并在绑定的处理程序中调用Canvas的yview()方法来实现滚动。具体实现可以参考下面的示例代码: ```python class Lnput_lnitialization(): def __init__(self, top, Number_of_rows): self.top = top int(data_demo.window_width // 3.9875) int(data_demo.window_height // 1.138) self.frame = tk.Frame(self.top, bg='Black', highlightthickness=2, highlightbackground='Black') self.frame.place(relx=0.739, rely=0.083, width=int(data_demo.window_width // 3.87), height=int(data_demo.window_height // 1.15)) self.canvas = tk.Canvas(self.frame) self.canvas.place(relx=0, rely=0, width=int(data_demo.window_width // 3.9875), height=int(data_demo.window_height // 1.15)) scrollbar = tk.Scrollbar(self.frame, command=self.canvas.yview) scrollbar.pack(side="right", fill="y") self.canvas.configure(yscrollcommand=scrollbar.set) self.button_frame = tk.Frame(self.canvas, bg='Yellow') self.button_frame.pack_propagate(False) # 禁止自动调整大小 self.button_frame.pack(fill=BOTH, expand=True) # 使其自适应大小 self.canvas.create_window((0, 0), window=self.button_frame, anchor="nw") self.button_frame.columnconfigure(0, weight=1) self.button_frame.columnconfigure(1, weight=1) self.button_frame.columnconfigure(2, weight=1) self.button_frame.columnconfigure(3, weight=1) self.button_frame.columnconfigure(4, weight=1) self.button_frame.columnconfigure(5, weight=1) self.Content(Number_of_rows) self.canvas.bind("<MouseWheel>", self.on_mousewheel) def on_mousewheel(self, event): self.canvas.yview_scroll(-1 * int(event.delta / 120), "units") ```

setTimeout(() => { document.querySelectorAll('.form-content .slt .el-input__prefix').forEach(el => { el.style.color = this.contents.inputIconColor el.style.lineHeight = this.contents.inputHeight }) document.querySelectorAll('.form-content .slt .el-input__suffix').forEach(el => { el.style.color = this.contents.inputIconColor el.style.lineHeight = this.contents.inputHeight }) document.querySelectorAll('.form-content .slt .el-input__icon').forEach(el => { el.style.lineHeight = this.contents.inputHeight }) }, 10 ) })

这段代码是在 10 毫秒后执行一个函数,用于修改表单中输入框的图标样式。具体来说,它首先遍历所有 class 为 `.form-content .slt .el-input__prefix` 的元素,设置它们的颜色和行高为 `this.contents.inputIconColor` 和 `this.contents.inputHeight`;然后遍历所有 class 为 `.form-content .slt .el-input__suffix` 的元素,设置它们的颜色和行高为 `this.contents.inputIconColor` 和 `this.contents.inputHeight`;最后遍历所有 class 为 `.form-content .slt .el-input__icon` 的元素,设置它们的行高为 `this.contents.inputHeight`。其中 `this.contents` 可能是一个对象,里面存放了一些表单相关的配置信息。这个函数的延迟执行是为了等待表单渲染完成后再修改样式,避免出现样式错乱的情况。

相关推荐

from keras import applications from keras.preprocessing.image import ImageDataGenerator from keras import optimizers from keras.models import Sequential, Model from keras.layers import Dropout, Flatten, Dense img_width, img_height = 256, 256 batch_size = 16 epochs = 50 train_data_dir = 'C:/Users/Z-/Desktop/kaggle/train' validation_data_dir = 'C:/Users/Z-/Desktop/kaggle/test1' OUT_CATAGORIES = 1 nb_train_samples = 2000 nb_validation_samples = 100 base_model = applications.VGG16(weights='imagenet', include_top=False, input_shape=(img_width, img_height, 3)) base_model.summary() for layer in base_model.layers[:15]: layer.trainable = False top_model = Sequential() top_model.add(Flatten(input_shape=base_model.output_shape[1:])) top_model.add(Dense(256, activation='relu')) top_model.add(Dropout(0.5)) top_model.add(Dense(OUT_CATAGORIES, activation='sigmoid')) model = Model(inputs=base_model.input, outputs=top_model(base_model.output)) model.compile(loss='binary_crossentropy', optimizer=optimizers.SGD(learning_rate=0.0001, momentum=0.9), metrics=['accuracy']) train_datagen = ImageDataGenerator(rescale=1. / 255, horizontal_flip=True) test_datagen = ImageDataGenerator(rescale=1. / 255) train_generator = train_datagen.flow_from_directory( train_data_dir, target_size=(img_height, img_width), batch_size=batch_size, class_mode='binary') validation_generator = test_datagen.flow_from_directory( validation_data_dir, target_size=(img_height, img_width), batch_size=batch_size, class_mode='binary', shuffle=False ) model.fit_generator( train_generator, steps_per_epoch=nb_train_samples / batch_size, epochs=epochs, validation_data=validation_generator, validation_steps=nb_validation_samples / batch_size, verbose=2, workers=12 ) score = model.evaluate_generator(validation_generator, nb_validation_samples / batch_size) scores = model.predict_generator(validation_generator, nb_validation_samples / batch_size)看看这段代码有什么错误

程序执行提示AttributeError: 'point_cloud_generator' object has no attribute 'widthself',优化程序class point_cloud_generator(): def __init__(self, rgb_file, depth_file, save_ply, camera_intrinsics=[784.0, 779.0, 649.0, 405.0]): self.rgb_file = rgb_file self.depth_file = depth_file self.save_ply = save_ply self.rgb = cv2.imread(rgb_file) self.depth = cv2.imread(self.depth_file, -1) print("your depth image shape is:", self.depth.shape) self.width = self.rgb.shape[1] self.height = self.rgb.shape[0] self.camera_intrinsics = camera_intrinsics self.depth_scale = 1000 def compute(self): t1 = time.time() depth = np.asarray(self.depth, dtype=np.uint16).T # depth[depth==65535]=0 self.Z = depth / self.depth_scale fx, fy, cx, cy = self.camera_intrinsics X = np.zeros((self.width, self.height)) Y = np.zeros((self.width, self.height)) for i in range(self.width): X[i, :] = np.full(X.shape[1], i) self.X = ((X - cx / 2) * self.Z) / fx for i in range(self.height): Y[:, i] = np.full(Y.shape[0], i) self.Y = ((Y - cy / 2) * self.Z) / fy data_ply = np.zeros((6, self.width * self.height)) data_ply[0] = self.X.T.reshape(-1)[:self.widthself.height] data_ply[1] = -self.Y.T.reshape(-1)[:self.widthself.height] data_ply[2] = -self.Z.T.reshape(-1)[:self.widthself.height] img = np.array(self.rgb, dtype=np.uint8) data_ply[3] = img[:, :, 0:1].reshape(-1)[:self.widthself.height] data_ply[4] = img[:, :, 1:2].reshape(-1)[:self.widthself.height] data_ply[5] = img[:, :, 2:3].reshape(-1)[:self.widthself.height] self.data_ply = data_ply t2 = time.time() print('calcualte 3d point cloud Done.', t2 - t1)

请详细解释下这段代码Rect<float> Framer::ComputeActiveCropRegion(int frame_number) { const float min_crop_size = 1.0f / options_.max_zoom_ratio; const float new_x_crop_size = std::clamp(region_of_interest_.width * options_.target_crop_to_roi_ratio, min_crop_size, 1.0f); const float new_y_crop_size = std::clamp(region_of_interest_.height * options_.target_crop_to_roi_ratio, min_crop_size, 1.0f); // We expand the raw crop region to match the desired output aspect ratio. const float target_aspect_ratio = static_cast<float>(options_.input_size.height) / static_cast<float>(options_.input_size.width) * static_cast<float>(options_.target_aspect_ratio_x) / static_cast<float>(options_.target_aspect_ratio_y); Rect<float> new_crop; if (new_x_crop_size <= new_y_crop_size * target_aspect_ratio) { new_crop.width = std::min(new_y_crop_size * target_aspect_ratio, 1.0f); new_crop.height = new_crop.width / target_aspect_ratio; } else { new_crop.height = std::min(new_x_crop_size / target_aspect_ratio, 1.0f); new_crop.width = new_crop.height * target_aspect_ratio; } const float roi_x_mid = region_of_interest_.left + (region_of_interest_.width / 2); const float roi_y_mid = region_of_interest_.top + (region_of_interest_.height / 2); new_crop.left = std::clamp(roi_x_mid - (new_crop.width / 2), 0.0f, 1.0f - new_crop.width); new_crop.top = std::clamp(roi_y_mid - (new_crop.height / 2), 0.0f, 1.0f - new_crop.height); const float normalized_crop_strength = std::powf(options_.crop_filter_strength, ElapsedTimeMs(timestamp_) / kUnitTimeSlice); active_crop_region_.left = IirFilter(active_crop_region_.left, new_crop.left, normalized_crop_strength); active_crop_region_.top = IirFilter(active_crop_region_.top, new_crop.top, normalized_crop_strength); active_crop_region_.width = IirFilter( active_crop_region_.width, new_crop.width, normalized_crop_strength); active_crop_region_.height = IirFilter( active_crop_region_.height, new_crop.height, normalized_crop_strength); timestamp_ = base::TimeTicks::Now(); if (VLOG_IS_ON(2)) { DVLOGFID(2, frame_number) << "region_of_interest=" << region_of_interest_; DVLOGFID(2, frame_number) << "new_crop_region=" << new_crop; DVLOGFID(2, frame_number) << "active_crop_region=" << active_crop_region_; } return active_crop_region_; }

没有GPU,优化程序class point_cloud_generator(): def init(self, rgb_file, depth_file, save_ply, camera_intrinsics=[312.486, 243.928, 382.363, 382.363]): self.rgb_file = rgb_file self.depth_file = depth_file self.save_ply = save_ply self.rgb = cv2.imread(rgb_file) self.depth = cv2.imread(self.depth_file, -1) print("your depth image shape is:", self.depth.shape) self.width = self.rgb.shape[1] self.height = self.rgb.shape[0] self.camera_intrinsics = camera_intrinsics self.depth_scale = 1000 def compute(self): t1 = time.time() depth = np.asarray(self.depth, dtype=np.uint16).T self.Z = depth / self.depth_scale fx, fy, cx, cy = self.camera_intrinsics X = np.zeros((self.width, self.height)) Y = np.zeros((self.width, self.height)) for i in range(self.width): X[i, :] = np.full(X.shape[1], i) self.X = ((X - cx / 2) * self.Z) / fx for i in range(self.height): Y[:, i] = np.full(Y.shape[0], i) self.Y = ((Y - cy / 2) * self.Z) / fy data_ply = np.zeros((6, self.width * self.height)) data_ply[0] = self.X.T.reshape(-1)[:self.width * self.height] data_ply[1] = -self.Y.T.reshape(-1)[:self.width * self.height] data_ply[2] = -self.Z.T.reshape(-1)[:self.width * self.height] img = np.array(self.rgb, dtype=np.uint8) data_ply[3] = img[:, :, 0:1].reshape(-1)[:self.width * self.height] data_ply[4] = img[:, :, 1:2].reshape(-1)[:self.width * self.height] data_ply[5] = img[:, :, 2:3].reshape(-1)[:self.width * self.height] self.data_ply = data_ply t2 = time.time() print('calcualte 3d point cloud Done.', t2 - t1) def write_ply(self): start = time.time() float_formatter = lambda x: "%.4f" % x points = [] for i in self.data_ply

解释下这段代码record_list = [] screen_width = 1024 screen_height = 768 interest_time_start_offset = 1200 interest_time_duration = 3000 while row_index <= fix_record.max_row: row_start = fix_record[row_index][0].value if row_start is None: break if row_start.startswith("trail"): record_list.clear() record_list.append(fix_record[row_index][0].value) record_list.append(images_info[image_index + 1][0].value) img_width = float(images_info[image_index + 1][1].value) img_height = float(images_info[image_index + 1][2].value) object1_xmin = float(images_info[image_index + 1][3].value) / img_width * screen_width object1_ymin = float(images_info[image_index + 1][4].value) / img_height * screen_height object1_xmax = float(images_info[image_index + 1][5].value) / img_width * screen_width object1_ymax = float(images_info[image_index + 1][6].value) / img_height * screen_height if images_info[image_index + 1][7].value is None: object2_xmin = -1.0 object2_ymin = -1.0 object2_xmax = -1.0 object2_ymax = -1.0 else: object2_xmin = float(images_info[image_index + 1][7].value) / img_width * screen_width object2_ymin = float(images_info[image_index + 1][8].value) / img_height * screen_height object2_xmax = float(images_info[image_index + 1][9].value) / img_width * screen_width object2_ymax = float(images_info[image_index + 1][10].value) / img_height * screen_height image_index += 1 row_index += 1 start_time = -1 end_time = -1 interest_duration_start = -1 interest_duration_end = -1 object1_attention_time = -1 object2_attention_time = -1 object1_times = 0 object2_times = 0

最新推荐

recommend-type

解决line-height=height元素高度但是文字并没有垂直居中的问题

先说下为什么line-height等于元素高度文字却没有垂直居中,其实line-height等于元素高度的时候文本并不是真的居中了,而是看着居中了,当元素高度和font-size差距较大的时候,这种不是真正的居中就越发的明显,这里...
recommend-type

CSS line-height行高上下居中垂直居中样式属性

常常使用line-height设置内容(图片、文字)行高上下居中样式效果。 一、line-height行高语法 复制代码代码如下:line-height:22px.jb51div{line-height:22px}line-height:200%.jb51div{line-height:200%} line-...
recommend-type

RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz

REALTEK 8188FTV 8188eus 8188etv linux驱动程序稳定版本, 支持AP,STA 以及AP+STA 共存模式。 稳定支持linux4.0以上内核。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

:YOLO目标检测算法的挑战与机遇:数据质量、计算资源与算法优化,探索未来发展方向

![:YOLO目标检测算法的挑战与机遇:数据质量、计算资源与算法优化,探索未来发展方向](https://img-blog.csdnimg.cn/7e3d12895feb4651b9748135c91e0f1a.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5rKJ6YaJ77yM5LqO6aOO5Lit,size_20,color_FFFFFF,t_70,g_se,x_16) # 1. YOLO目标检测算法简介 YOLO(You Only Look Once)是一种
recommend-type

def ObjFun(x,y,beta): # 目标函数 """ Logistic regression loss function :param beta: model parameter vector :param x: feature matrix :param y: label vector :return: loss value """ n = x.shape[0] p = x.shape[1] pred = 1 / (1 + np.exp(-np.dot(x, beta))) pred = np.clip(pred, 1e-15, 1 - 1e-15) # 将预测值限制在一个很小的区间内 ObjVal = -np.sum(y * np.log(pred) + (1 - y) * np.log(1 - pred)) / n return ObjVal

好的,根据上面的目标函数,我们可以推导出其对应的梯度向量函数,如下所示: def gradient(x, y, beta): """ Compute gradient of the logistic regression loss function :param beta: model parameter vector :param x: feature matrix :param y: label vector :return: gradient vector """ n = x.shape[0] pred = 1 /
recommend-type

c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf

校园超市商品信息管理系统课程设计旨在帮助学生深入理解程序设计的基础知识,同时锻炼他们的实际操作能力。通过设计和实现一个校园超市商品信息管理系统,学生掌握了如何利用计算机科学与技术知识解决实际问题的能力。在课程设计过程中,学生需要对超市商品和销售员的关系进行有效管理,使系统功能更全面、实用,从而提高用户体验和便利性。 学生在课程设计过程中展现了积极的学习态度和纪律,没有缺勤情况,演示过程流畅且作品具有很强的使用价值。设计报告完整详细,展现了对问题的深入思考和解决能力。在答辩环节中,学生能够自信地回答问题,展示出扎实的专业知识和逻辑思维能力。教师对学生的表现予以肯定,认为学生在课程设计中表现出色,值得称赞。 整个课程设计过程包括平时成绩、报告成绩和演示与答辩成绩三个部分,其中平时表现占比20%,报告成绩占比40%,演示与答辩成绩占比40%。通过这三个部分的综合评定,最终为学生总成绩提供参考。总评分以百分制计算,全面评估学生在课程设计中的各项表现,最终为学生提供综合评价和反馈意见。 通过校园超市商品信息管理系统课程设计,学生不仅提升了对程序设计基础知识的理解与应用能力,同时也增强了团队协作和沟通能力。这一过程旨在培养学生综合运用技术解决问题的能力,为其未来的专业发展打下坚实基础。学生在进行校园超市商品信息管理系统课程设计过程中,不仅获得了理论知识的提升,同时也锻炼了实践能力和创新思维,为其未来的职业发展奠定了坚实基础。 校园超市商品信息管理系统课程设计的目的在于促进学生对程序设计基础知识的深入理解与掌握,同时培养学生解决实际问题的能力。通过对系统功能和用户需求的全面考量,学生设计了一个实用、高效的校园超市商品信息管理系统,为用户提供了更便捷、更高效的管理和使用体验。 综上所述,校园超市商品信息管理系统课程设计是一项旨在提升学生综合能力和实践技能的重要教学活动。通过此次设计,学生不仅深化了对程序设计基础知识的理解,还培养了解决实际问题的能力和团队合作精神。这一过程将为学生未来的专业发展提供坚实基础,使其在实际工作中能够胜任更多挑战。
recommend-type

"互动学习:行动中的多样性与论文攻读经历"

多样性她- 事实上SCI NCES你的时间表ECOLEDO C Tora SC和NCESPOUR l’Ingén学习互动,互动学习以行动为中心的强化学习学会互动,互动学习,以行动为中心的强化学习计算机科学博士论文于2021年9月28日在Villeneuve d'Asq公开支持马修·瑟林评审团主席法布里斯·勒菲弗尔阿维尼翁大学教授论文指导奥利维尔·皮耶昆谷歌研究教授:智囊团论文联合主任菲利普·普雷教授,大学。里尔/CRISTAL/因里亚报告员奥利维耶·西格德索邦大学报告员卢多维奇·德诺耶教授,Facebook /索邦大学审查员越南圣迈IMT Atlantic高级讲师邀请弗洛里安·斯特鲁布博士,Deepmind对于那些及时看到自己错误的人...3谢谢你首先,我要感谢我的两位博士生导师Olivier和Philippe。奥利维尔,"站在巨人的肩膀上"这句话对你来说完全有意义了。从科学上讲,你知道在这篇论文的(许多)错误中,你是我可以依
recommend-type

:YOLO目标检测算法的最佳实践:模型训练、超参数调优与部署优化,打造高性能目标检测系统

![:YOLO目标检测算法的最佳实践:模型训练、超参数调优与部署优化,打造高性能目标检测系统](https://img-blog.csdnimg.cn/20201024153508415.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1NNRjA1MDQ=,size_16,color_FFFFFF,t_70) # 1. YOLO目标检测算法概述 **1.1 YOLO算法简介** YOLO(You Only Look Once)是一种
recommend-type

pecl-memcache-php7 下载

你可以通过以下步骤来下载 pecl-memcache-php7: 1. 打开终端或命令行工具。 2. 输入以下命令:`git clone https://github.com/websupport-sk/pecl-memcache.git` 3. 进入下载的目录:`cd pecl-memcache` 4. 切换到 php7 分支:`git checkout php7` 5. 构建和安装扩展:`phpize && ./configure && make && sudo make install` 注意:在执行第5步之前,你需要确保已经安装了 PHP 和相应的开发工具。