当我处理一堆图像时,其中一个图像出现此错误
File "/home/tensorflowpython/firstmodel/yololoss.py", line 153, in data_generator
image, box = get_random_data(annotation_lines[i], input_shape, random=True)
File "/home/tensorflowpython/firstmodel/yololoss.py", line 226, in get_random_data
image = image.resize((nw,nh), Image.BICUBIC)
File "/home/tensorflowpython/kenv/lib/python3.6/site-packages/PIL/Image.py", line 1858, in resize
self.load()
File "/home/tensorflowpython/kenv/lib/python3.6/site-packages/PIL/ImageFile.py", line 247, in load
"(%d bytes not processed)" % len(b)
OSError: image file is truncated (25 bytes not processed)
Run Code Online (Sandbox Code Playgroud)
我已经尝试过这里建议的解决方案,但它不起作用
我的代码看起来像这样
from PIL import Image
def get_random_data(annotation_line, input_shape, random=True, max_boxes=20, jitter=.3, hue=.1, sat=1.5, val=1.5, proc_img=True):
Image.LOAD_TRUNCATED_IMAGES = True
line = annotation_line.split()
image = Image.open(line[0])
iw, ih …Run Code Online (Sandbox Code Playgroud) 我需要一个标签窗格,左侧有标签,标签文字/图形需要水平
几个月前我在Scenebuilder上做过这个.
但是,当我通过Java代码添加其他选项卡时,选项卡位于左侧,但图形文本是垂直的,与使用"场景"构建器创建的选项卡不同.
在附图中,前两个选项卡通过Scenebuilder创建,它们的方向正确,第三个是使用Java代码动态添加的.
Tab studentAdmission = new Tab();
studentAdmission.setContent((Parent)new FXMLLoader(getClass().getResource("Customer_View.fxml")).load());
studentAdmission.setGraphic(new Label("Student Admission"));
mainTab.getTabs().add(studentAdmission);
Run Code Online (Sandbox Code Playgroud)

有人可能会建议为什么这个标签不会像另一个那样旋转.
我的 UI 中有一个 TableView,它显示数据库中的用户列表。该表的一列是可编辑的,当启用编辑时,该特定列的单元格将变成树形视图,列出可以选择的各种选项。
只是为了澄清,我试图在表格单元格上实现类似日期选择器或颜色选择器的功能,但使用我自己的项目列表作为树。
该表是这样定义的
private TableView<User> userTable;
Run Code Online (Sandbox Code Playgroud)
显示树视图的特定列定义如下
private TableColumn<User, TreeView> col4;
Run Code Online (Sandbox Code Playgroud)
我设置了像这样的 setcellFactory 方法来显示树
col4.setCellFactory(new Callback<TableColumn<User,TreeView>, TableCell<User,TreeView>>() {
@Override
public TableCell<User, TreeView> call(
TableColumn<User, TreeView> param)
{
returns a comboboxtablecell which is filled with a tree
}
});
Run Code Online (Sandbox Code Playgroud)
在表中的相应列中,当我单击单元格时,该单元格显示一个组合框,打开时的组合框显示树值。
但是,当单元格处于不可编辑状态时,我不确定应该如何使用字符串值设置 setcellValuefactory
col4.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<User,TreeView>, ObservableValue<TreeView>>() {
@Override
public ObservableValue<TreeView> call(
CellDataFeatures< User,TreeView> param)
{
}
}
Run Code Online (Sandbox Code Playgroud)
当单元格处于不可编辑状态时,我想将树视图内的值显示为字符串。我不知道如何根据方法签名返回树视图类型的可观察值并仍然显示字符串。