POI处理导入excel发生RecordInputStream$LeftoverDataException处理记录

NPOI.HSSF.Record.LeftoverDataException: Initialisation of record 0x31 left 4 bytes remaining still t NPOI在导入excel文件的时候,会出现如下错误: NPOI.HSSF.Record.LeftoverDataException: Initialisation of record 0x31 left 4 bytes remaining still to be read. 但是用excel能够正常打开,并且在excel中保存后,可以正常的导入,找到原因和方法如下: 原因(链接地址) ... 阅读详情
AI摘要

针对特定Excel文件导入系统异常的问题,通过分析发现文件为兼容模式,并存在左余数据异常。通过对POI源码进行定制化修改,包括忽略异常数据、调整记录读取方式等手段,最终实现了对非标准Excel文件的成功导入。

项目场景:

现场运维反馈,甲方爸爸有业务导入excel表单发生“系统异常”,但是不是每个人都有这种问题,个别用户导入的excel存在异常,由于网络隔离和生产日志管理原因,一直无法拿到error日志,只能请求到家里协助定位问题。

但是家里不管怎么导入excel文件就是无法复现,故怀疑是文件问题,让现场人员把业务的excel表数据拷贝到新建的excel里面试试,结果导入成功,所以只能说临时解决了问题。

通过各种申请,层层审批,终于拿到了导入出错的原始文件,开始进行分析解决问题之路。


问题描述

文件问题:拿到原始文件后,通过office打开,发现打开文件标题上出现了“兼容模式”字样,如下图:

此时可以确认文件应该是第三方应用系统中导出的文件,而非通过excel进行制作的表格数据。

导入程序报错信息:通过把此文件导入测试,发现错误很明显

org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0x31(FontRecord) left 4 bytes remaining still to be read.
	at org.apache.poi.hssf.record.RecordInputStream.hasNextRecord(RecordInputStream.java:188)
	at org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:234)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:488)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:343)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:306)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:258)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:241)
    ... ...

通过异常关键字进行检索,很多解决方案都是文件另存未就能解决问题,而没有进行具体解决。本着能不改就不改的理念,让PM跟甲方爸爸进行了沟通,得到的答复是:凭什么要另存为,下载下来的数据都是都是核心数据,另存为如果改动了这个责任谁来担当,你们必须解决。好吧,都是“甩锅”。

原因分析:

通过异常报错位置,在IDEAL里面找到反编译后的代码位置,发现发生问题的位置原逻辑如下:

 public boolean hasNextRecord() throws LeftoverDataException {
        if (this._currentDataLength != -1 && this._currentDataLength != this._currentDataOffset) {
            throw new LeftoverDataException(this._currentSid, this.remaining());
        }
        if (this._currentDataLength != DATA_LEN_NEEDS_TO_BE_READ) {
            this._nextSid = this.readNextSid();
        }
            return this._nextSid != INVALID_SID_VALUE;
    }

此处由于 this._currentDataLength != this._currentDataOffset 导致抛出异常。

通过借鉴:NPOI.HSSF.Record.LeftoverDataException: Initialisation of record 0x31 left 4 bytes remaining still t_xue251248603的博客-CSDN博客

此篇文章中的方法,进行了处理之路。


解决方案:

很多都说需要对源码重新打包,此种做法在我们项目中是无法实施的,按照合同协议要求,第三方包,必须使用原生,不允许引用项目中的第三方包,所有包都是maven仓库中的包。所以只能选择另外的一个解决方案:重写jar包中的类,通过JVM的编译输出优先使用项目src中的类原理来实现覆盖jar包中的类的方法进行处理。

首先,新建包:org.apache.poi.hssf.record,然后新建类RecordInputStream,保持跟poi包中一致,再进行代码修改。

 public boolean hasNextRecord() throws LeftoverDataException {
        if (this._currentDataLength != -1 && this._currentDataLength != this._currentDataOffset) {
//            throw new LeftoverDataException(this._currentSid, this.remaining());
            readToEndOfRecord();
        }
        if (this._currentDataLength != DATA_LEN_NEEDS_TO_BE_READ) {
            this._nextSid = this.readNextSid();
        }
            return this._nextSid != INVALID_SID_VALUE;
    }
    private void readToEndOfRecord() {
        while (this._currentDataOffset < this._currentDataLength)
            readByte();
    }

(此处代码参考网上方法进行处理) ,再结合刚刚参考的文档说明规避“Found EOFRecord before WindowTwoRecord was encountered”异常,故还要重新建类RecordOrderer以此来覆盖poi.jar里面的此类,此类的包路径为:org.apache.poi.hssf.model。修改代码如下:

public static boolean isEndOfRowBlock(int sid) {
        switch (sid) {
            case EOFRecord.sid:
                //为了解决其他非标准excel生成的文件进行导入
//                throw new RuntimeException("Found EOFRecord before WindowTwoRecord was encountered");
            case DrawingRecord.sid:
            case DrawingSelectionRecord.sid:
            case ObjRecord.sid:
            case TextObjectRecord.sid:
            case ColumnInfoRecord.sid: // See Bugzilla 53984
            case GutsRecord.sid:   // see Bugzilla 50426
            case WindowOneRecord.sid:
                // should really be part of workbook stream, but some apps seem to put this before WINDOW2
            case WindowTwoRecord.sid:
                return true;
            case DVALRecord.sid:
                return true;
            default:
                return PageSettingsBlock.isComponentRecord(sid);
        }
    }

让其EOFRecord.sid的数据不抛出异常,直接注释掉。

本以为一切顺利,结果调试中出现以下异常:

java.lang.RuntimeException: Unexpected record type (org.apache.poi.hssf.record.PaneRecord)
	at org.apache.poi.hssf.record.aggregates.RowRecordsAggregate.<init>(RowRecordsAggregate.java:97)
	at org.apache.poi.hssf.model.InternalSheet.<init>(InternalSheet.java:183)
	at org.apache.poi.hssf.model.InternalSheet.createSheet(InternalSheet.java:122)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:354)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:306)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:258)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:241)

好吧,继续处理RowRecordsAggregate类吧,还是按照覆盖模式进行处理。

修改代码如下:

    public RowRecordsAggregate(RecordStream rs, SharedValueManager svm) {
        this(svm);

        while(true) {
            while(rs.hasNext()) {
                Record rec = rs.getNext();
                switch (rec.getSid()) {
                    case DConRefRecord.sid:
                        this.addUnknownRecord(rec);
                    case  DBCellRecord.sid:
                        break;
                    case RowRecord.sid:
                        this.insertRow((RowRecord)rec);
                        break;
                    default:
                        if (rec instanceof UnknownRecord) {
                            this.addUnknownRecord(rec);

                            while(rs.peekNextSid() == 60) {
                                this.addUnknownRecord(rs.getNext());
                            }
                        } else if (rec instanceof MulBlankRecord) {
                            this._valuesAgg.addMultipleBlanks((MulBlankRecord)rec);
                        } else {
                            //此处为了解决非标excel文件导入而重新进行处理
//                            if (!(rec instanceof CellValueRecordInterface)) {
//                                throw new RuntimeException("Unexpected record type (" + rec.getClass().getName() + ")");
//                            }
//
//                            this._valuesAgg.construct((CellValueRecordInterface)rec, rs, svm);
                            if (rec instanceof CellValueRecordInterface) {
                                this._valuesAgg.construct((CellValueRecordInterface) rec, rs, svm);
                            }
                        }
                }
            }

            return;
        }
    }

好了,现在导入提供的原始文件,终于不报错了。

PS:发现阿里的easyExcel的github上也有人遇到此问题,但是由于是底层Poi问题,所以上面建议也是修改poi.jar源码模式进行处理。使用poi.jar版本为4.1.0 ,后续升级POI还要看此三个类是有有变更,一旦变更还要跟着进行处理(o(╥﹏╥)o)。

org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException 解决POI读取EXCEL时报org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException异常 立即下载

相关推荐

POI 导入Excel 提醒LeftoverDataException求帮助

POI 导入Excel 提醒LeftoverDataException求帮助

Npoi导入时:Found EOFRecord before WindowTwoRecord was encountered

Firstly, open the file using Excel and then simply re-save it. Does this clear up the problem? If so then yes, it is likely that the file does not conform with the specification. 把excel打开,保...

weixin_30323961的博客 1936

Npoi.Mapper:使用此工具可以导入或导出带有Excel文件的数据。 该工具是通过NPOI在强类​​型对象和Excel数据之间基于约定的映射器

恩波伊·马普(Npoi.Mapper) 通过NPOI(电报组 )在强类型对象和Excel数据之间基于约定的映射器。 这个项目完成了我的工作任务,我在项目中经常使用它。 随时提交错误或提出请求请求... v3现在支持导入和导出为dynamic类型。 从NuGet安装 在程序包管理器控制台中: PM> Install-Package Npoi.Mapper 从Excel获取强类型对象(XLS或XLSX) var mapper = new Mapper ( " Book1.xlsx " ); var objs1 = mapper . Take < SampleClass>( " sheet2 " ); // You can take objects from the same sheet with different type. var objs2 = mapper . Take <

读excel报错LeftoverDataException

excel报错LeftoverDataException

csdnyq的博客 1306

极坐标格式算法(PFA)-SAR成像算法系列(六)

SAR成像算法:极坐标格式算法,介绍了算法的基本原理以及实现步骤,包含dechirp处理、RVP补偿,距离插值、方位插值。文后附有代码,可根据自身情况下载。

yjh_2019的博客 1万+

nCode:GlyphWorks案例教程一

nCode GlyphWorks案例一Comparing Frequency Content of Two Different Tests案例文件目标配置选择数据 Comparing Frequency Content of Two Different Tests 在本案例中,我们将比较来自两个不同测试的六个加速计通道的频率内容。将三轴加速度计放置在车辆的左前角和右前角,然后分别在两个不同的试验路面上行驶12分钟以上。 案例文件 此案例的文件(采用nCode DAC格式)位于nCode安装目录下的\demo

追月行的博客 1万+

Poi3.9 写入时org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException:

[code="java"]POIFSFileSystem fs =new POIFSFileSystem(new FileInputStream(file)); HSSFWorkbook workBook= new HSSFWorkbook(fs); org.apache.poi.hssf.record.RecordInputStream$LeftoverD...

songer4081的专栏 3088

软件缺陷(定义+表现形式+优先级+信息+产生原因),看完这篇文章就懂了

软件缺陷软件缺陷的定义软件缺陷的表现形式软件缺陷产生的原因软件缺陷的根源软件缺陷的费用软件缺陷的信息 软件缺陷的定义 IEEE 1983 of IEEE Stardard 729中软件缺陷做了一个标准的定义: 从产品内部看,软件缺陷是软件产品开发或维护过程中所存在的错误、毛病等各种问题;从外部看,软件缺陷是系统所需要实现的某种功能的失效或违背。 因此软件缺陷就是软件产品中所存在的问题,最终表现为用户所需要的功能没有完全实现,没有满足用户的需求。 缺陷不是bug,缺陷包含bug,缺陷的范围更大。 软件缺陷

qq_40676418的博客 1万+

poi 报表导入问题记录

org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException

qq_32265719的博客 544

Autosar结合simulink的汽车应用层软件开发实例

本文基于汽车应用开发案例,并结合Autosar相关知识,生成具有Autosar标准的汽车应用层开发代码,以供学习和参考。以上就是本篇内容,主要是利用Simulink创建Autosar接口并进行端口映射的方法。

m0_64899535的博客 2161

WS2812呼吸灯效果实战:用STM32的PWM+DMA实现流畅渐变(附完整代码)

本文详细介绍了如何使用STM32的PWM+DMA技术实现WS2812呼吸灯效果,提供完整的代码示例和调试技巧。通过PWM波形编码和DMA传输机制,解决了传统IO模拟控制方式的高CPU占用问题,实现了流畅的LED渐变效果,适用于各种嵌入式开发场景。

weixin_30566063的博客 461

LeftoverDataException,依赖包,apache license 2.0

1. poi3.9LeftoverDataException org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0x1D left 1 bytes remaining still to be read. at org.apache.poi.hss...

weixin_34114823的博客 850

疑难问题(二)——PyTorch 2.3.0 ‘import torch‘ 错误排查:深入解析‘shm.dll‘加载失败与系统路径修复

本文深入解析了在Windows系统上安装PyTorch 2.3.0后,执行'import torch'时遇到的'shm.dll'加载失败错误(OSError)。该问题通常源于系统DLL搜索路径缺失,导致无法找到关键的共享内存通信组件或其依赖项。文章提供了核心解决方案:通过手动修改PyTorch的`__init__.py`文件,将用户基目录下的Library\bin路径添加到DLL搜索列表中,从而从根本上修复此导入错误,并给出了详细的修改步骤和验证方法。

weixin_29056865的博客 311

Record some Linux commands (6)

cut 取出 student.txt 文件中的第一列和第三列,可以使用如下命令:cut -f 1,3 -d ' ' student.txt 取出 student.txt 文件中的前三列,可以使用如下命令: cut -f 1-3 -d ' ' student.txt 取出 student.txt 文件中除第一列的其他列,可以使用如下命令:cut -f 1 -d ' ' student.txt ...

weixin_41576308的博客 266

(四) OpenClaw-Skill技能全面了解和自定义技能

OpenClaw Skills是提升AI代理功能性的关键模块。本文系统介绍了Skills的核心概念、获取渠道和创建方法。Skills作为标准化指令集合,能让OpenClaw从单纯理解升级为实际执行任务,相比传统System Prompt具有模块化、可复用等优势。用户可通过Clawhub官方商店、GitHub社区等渠道获取5700+现成技能,或按需开发自定义Skill。文章详细演示了创建"Hello World"示例技能的完整流程,包括编写Python脚本、配置SKILL.md文件、部署。

直到世界的尽头 8316

【Matlab】从零开始掌握 MATLAB 安装激活:从环境搭建到问题解决全指南

打开 MATLAB,点击 “主页 - 设置路径”;点击 “添加文件夹”,选择自定义的工作文件夹,点击 “保存”,重启 MATLAB 生效。MATLAB R2024a 的安装与激活是开启 MATLAB 学习的第一步,也是构建稳定学习环境的基础。本文从安装前准备、分步操作、验证测试、问题解决到环境优化,完整覆盖了新手所需的所有知识点 —— 核心要点在于:确认系统兼容、使用合法授权、选择纯英文安装路径、完成功能验证。

unber的博客 597

C#中Initialisation of record 0x86 left 2 bytes remaining still to be read报错的问题

C#中Initialisation of record 0x86 left 2 bytes remaining still to be read报错的问题

weixin_47699380的博客 1070

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

POI or jxl 在不能读取Excel文件记录时的处理办法之一

  出现的问题:   在读第一个文件的时候一切正常,但是在读另一个从网页中“另存为Excel文件”的Excel文件时候出现以下异常: 1、POI的异常说明:org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0x86 left 2 byte...

weixin_33851177的博客 625

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Unread 12 bytes of record 0x18

poi导入excel 收到了问题数据在本地更改后再打开excel就提示宏病毒,软件管家还把excel处理了。 debug 发现HSSFWorkbook workbook = new HSSFWorkbook(fis); 这一步就直接跳出,抛出异常; 最后解决:禁用软件管家, 下一个wps用wps编辑excel就不会出现问题了 备注:寻找真理的道路每一步都很艰难,不一定那一步错了还不知道

qq_39493105的博客 465

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

poi处理excel问题

Initialisation of record 0x1D left 1 bytes remaining still to be read.解决方案一:将excel另存为新的文件,就可以。 解决方案二:http://download.csdn.net/download/lw_zj_ywn/10039072 可以在这里下载这个jar包,把你本地的替换掉。

lw_zj_ywn的博客 3942

LeftoverDataException.

在用java poi 3.8操作excel的时候,在打开一个已有excel文件时,有时候会报错: org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0x1D left 1 bytes remaining still to be read. at o...

weixin_34413103的博客 922

java文件损坏_java – 损坏的文件处理

我想知道如果任何人有任何建议处理损坏的文件与Apache POI我试图打开一个文件,并收到此消息:Exception in thread "main" org.apache.poi.hssf.record.RecordInputStream$LeftoverDataException: Initialisation of record 0x1C left 2 bytes remaining sti...

weixin_31036949的博客 1172

POI如何判断excel文件的格式

文章转载链接:https://blog.csdn.net/reggergdsg/article/details/104431901

StrongHYQ的博客 1212
上一篇: SpringBoot使用SpringContextUtils.getBean启动报空指针处理记录
下一篇: redisCluster集群相关查询结果详解
ghostp
博客等级 码龄18年 13粉丝 12原创
评论 8
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值