接上一篇
- 这样的时间段有成百上千条该如何处理?
- 如果我们需要根据具有日期交集的时间段分组呢?
- 如果我们的业务不是日期,而是其他数据类型呢?如何抽象出计算模型?非日期型数据也可以进行分组?
上一篇分享日期取交集的核心逻辑。 但映射到具体业务上可能有更复杂的场景,比如第一个问题,两个日期取交集还好搞好,但日期段很多的情况下,如何按每一个时间段相同的数据进行分组呢。
即每两个红点之间的日期不能出现断点,要么没有交集,有交集就一定是连续的。 所以解决这个问题的第一步就是如何确定红点(这一点很重要,凭直觉,遵照人脑思维落点,如果根据日期探测,逻辑将变得非常困难)。
- 第一步确定之后,我们根据所有日期段的开始和截止点进行坐标落点
- 第二步根据坐标点,确定我们将要拆分的日期段组。
- 第三步 日期段组的起始时间确定后,再依次根据日期取交集,即可实现多日期段下的日期交集逻辑。
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sparrow.core.algorithm.gouping;
import java.util.*;
/**
* E 为段类型 D为点类型
* @author harry
*/
public class Coordinate<E extends Segment<D>, D extends Comparable> {
public Coordinate(List<E> dataList) {
this.dataList = dataList;
}
private List<E> dataList = new ArrayList<E>();
protected List<Segment<D>> segments = new ArrayList<Segment<D>>();
protected List<Point<D>> coordinate = new ArrayList<Point<D>>();
public List<Point<D>> getCoordinate() {
return coordinate;
}
//画从标点
public void draw() {
Map<Comparable, Point<D>> coordinate = new TreeMap<Comparable, Point<D>>();
for (E segment : this.dataList) {
Point<D> point = coordinate.get(segment.getStart().getPoint());
if (point == null) {
point = new Point<D>(segment.getStart().getPoint(), true, null);
coordinate.put(segment.getStart().getPoint(), point);
}
point = coordinate.get(segment.getEnd().getPoint());
if (point == null) {
point = new Point<D>(segment.getEnd().getPoint(), null, true);
coordinate.put(segment.getEnd().getPoint(), point);
}
}
this.coordinate = new ArrayList<Point<D>>(coordinate.values());
}
//分组,可被重写实现
public void section() {
for (int i = 0; i < this.coordinate.size() - 1; i++) {
Point<D> current = this.coordinate.get(i);
Point<D> next = this.coordinate.get(i + 1);
this.segments.add(new Segment<D>(current, next));
}
}
//对每组数据聚合操作
public Map<Segment<D>, List<E>> aggregation() {
Map<Segment<D>, List<E>> segmentMap = new HashMap<Segment<D>, List<E>>();
for (Segment<D> segment : this.segments) {
segmentMap.put(segment, this.aggregation(segment));
}
return segmentMap;
}
private List<E> aggregation(Segment<D> s) {
List<E> segments = new ArrayList<E>();
for (E segment : this.dataList) {
if (segment.getStart().getPoint().compareTo(s.getStart().getPoint()) > 0) {
continue;
}
if (segment.getEnd().getPoint().compareTo(s.getStart().getPoint()) > 0) {
segments.add(segment);
}
}
return segments;
}
public List<Segment<D>> getSegments() {
return segments;
}
}
类封装之后可供上层业务端调用,为考虑其他业务场景,非日期类型数据的取交集我们将日期段类定义为泛型(类型参数化)
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sparrow.core.algorithm.gouping;
/**
* @author by harry
*/
public class Segment<T extends Comparable> {
private Point<T> start;
private Point<T> end;
public Segment(T start, T end) {
if (end.compareTo(start) < 0) {
throw new IllegalArgumentException("this.end<this.start");
}
this.start = new Point<T>(start);
this.end = new Point<T>(end);
}
public Segment(Point<T> start, Point<T> end) {
if (end.getPoint().compareTo(start.getPoint()) < 0) {
throw new IllegalArgumentException("end=" + end.getPoint() + "< start=" + start.getPoint());
}
this.start = start;
this.end = end;
}
public Point<T> getStart() {
return start;
}
public void setStart(Point<T> start) {
this.start = start;
}
public Point<T> getEnd() {
return end;
}
public void setEnd(Point<T> end) {
this.end = end;
}
public boolean equals(Segment<T> segment) {
if (this.start.getPoint().compareTo(segment.start.getPoint()) != 0) {
return false;
}
return this.end.getPoint().compareTo(segment.end.getPoint()) == 0;
}
public Segment<T> intersection(Segment<T> segment) {
if (segment.getEnd().getPoint().compareTo(segment.getStart().getPoint()) < 0) {
throw new IllegalArgumentException("segment.end < segment.start");
}
//取大的起始节点
Point<T> start = this.start.getPoint().compareTo(segment.start.getPoint()) > 0 ? this.start : segment.start;
//取小的截止节点
Point<T> end = this.end.getPoint().compareTo(segment.end.getPoint()) < 0 ? this.end : segment.end;
if (start.getPoint().compareTo(end.getPoint()) <= 0) {
return new Segment(start, end);
}
return null;
}
public Segment union(Segment<T> segment) {
if (segment.getEnd().getPoint().compareTo(segment.getStart().getPoint()) < 0) {
throw new IllegalArgumentException("segment.end < segment.start");
}
//取小的起始节点
Point<T> start = this.start.getPoint().compareTo(segment.start.getPoint()) < 0 ? this.start : segment.start;
//取大的截止节点
Point<T> end = this.end.getPoint().compareTo(segment.end.getPoint()) > 0 ? this.end : segment.end;
if (start.getPoint().compareTo(end.getPoint()) <= 0) {
return new Segment<T>(start, end);
}
return null;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Segment<?> segment = (Segment<?>) o;
return start.equals(segment.start) && end.equals(segment.end);
}
@Override
public int hashCode() {
int result = start.hashCode();
result = 31 * result + end.hashCode();
return result;
}
@Override
public String toString() {
return "Segment{" +
"start=" + start.getPoint() +
", end=" + end.getPoint() +
'}';
}
}
如果segment还有其他的属性,可以继承实现segment类
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sparrow.facade.segment;
import com.sparrow.constant.DATE_TIME;
import com.sparrow.core.algorithm.gouping.Segment;
import com.sparrow.utility.DateTimeUtility;
/**
* @author harry
*/
public class BusinessSegment extends Segment<Long> {
public BusinessSegment(Long id, String type, Long start, Long end) {
super(start, end);
this.id = id;
this.type = type;
}
//自定义属 性
private Long id;
//自定义属 性
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public String toString() {
String start=DateTimeUtility.getFormatTime((Long) this.getStart().getPoint(), DATE_TIME.FORMAT_YYYY_MM_DD);
String end=DateTimeUtility.getFormatTime((Long)this.getEnd().getPoint(), DATE_TIME.FORMAT_YYYY_MM_DD);
return "cat-record{" +
"id=" + id +
", type='" + type + '\'' +
"} " + start+"-"+end;
}
}
具体业务的分组逻辑可能不同,继承重写section方法即可
static class IntegerCoordinate extends Coordinate<BusinessSegment, Long> {
public IntegerCoordinate(List<BusinessSegment> dataList) {
super(dataList);
}
@Override
public void section() {
for (Point<Long> point : this.coordinate) {
System.out.println(DateTimeUtility.getFormatTime(point.getPoint(), DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS));
}
for (int i = 0; i < this.coordinate.size() - 1; i++) {
Point<Long> current = this.coordinate.get(i);
Point<Long> start = Point.copy(current);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(start.getPoint());
if (calendar.get(Calendar.HOUR_OF_DAY) == 23) {
calendar.add(Calendar.SECOND, 1);
start.setPoint(calendar.getTimeInMillis());
}
Point<Long> next = this.coordinate.get(i + 1);
Point<Long> end = Point.copy(next);
if (DateTimeUtility.getInterval(start.getPoint(), next.getPoint(), DATE_TIME_UNIT.SECOND) <= 5) {
i++;
continue;
}
calendar.setTimeInMillis(end.getPoint());
if (calendar.get(Calendar.HOUR_OF_DAY) == 0) {
calendar.add(Calendar.SECOND, -1);
end.setPoint(calendar.getTimeInMillis());
}
System.out.println(DateTimeUtility.getFormatTime(start.getPoint(), DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS) + "-" +
DateTimeUtility.getFormatTime(end.getPoint(), DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS));
this.segments.add(new Segment<Long>(start, end));
}
}
}
demo示例
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sparrow.facade.segment;
import com.sparrow.constant.DATE_TIME;
import com.sparrow.core.algorithm.gouping.Point;
import com.sparrow.core.algorithm.gouping.Segment;
import com.sparrow.core.algorithm.gouping.Coordinate;
import com.sparrow.enums.DATE_TIME_UNIT;
import com.sparrow.utility.DateTimeUtility;
import java.util.*;
/**
* @author harry
*/
public class Main {
static class IntegerCoordinate extends Coordinate<BusinessSegment, Long> {
public IntegerCoordinate(List<BusinessSegment> dataList) {
super(dataList);
}
@Override
public void section() {
for (Point<Long> point : this.coordinate) {
System.out.println(DateTimeUtility.getFormatTime(point.getPoint(), DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS));
}
for (int i = 0; i < this.coordinate.size() - 1; i++) {
Point<Long> current = this.coordinate.get(i);
Point<Long> start = Point.copy(current);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(start.getPoint());
if (calendar.get(Calendar.HOUR_OF_DAY) == 23) {
calendar.add(Calendar.SECOND, 1);
start.setPoint(calendar.getTimeInMillis());
}
Point<Long> next = this.coordinate.get(i + 1);
Point<Long> end = Point.copy(next);
if (DateTimeUtility.getInterval(start.getPoint(), next.getPoint(), DATE_TIME_UNIT.SECOND) <= 5) {
i++;
continue;
}
calendar.setTimeInMillis(end.getPoint());
if (calendar.get(Calendar.HOUR_OF_DAY) == 0) {
calendar.add(Calendar.SECOND, -1);
end.setPoint(calendar.getTimeInMillis());
}
System.out.println(DateTimeUtility.getFormatTime(start.getPoint(), DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS) + "-" +
DateTimeUtility.getFormatTime(end.getPoint(), DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS));
this.segments.add(new Segment<Long>(start, end));
}
}
}
enum SEGMENT_TYPE {
TYPE_001,
TYPE_002,
TYPE_003,
TYPE_004,
TYPE_005,
TYPE_006,
TYPE_007,
TYPE_008,
TYPE_009,
TYPE_010
}
public static void main(String[] args) {
List<BusinessSegment> list = new ArrayList<BusinessSegment>();
//Long id, String type, Integer start, Integer end
list.add(new BusinessSegment(1L, SEGMENT_TYPE.TYPE_001.name(), DateTimeUtility.parse("2018-02-05 00:00:00", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS), DateTimeUtility.parse("2018-02-11 23:59:59", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS)));
list.add(new BusinessSegment(1L, SEGMENT_TYPE.TYPE_002.name(), DateTimeUtility.parse("2018-02-06 00:00:00", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS), DateTimeUtility.parse("2018-02-10 23:59:59", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS)));
list.add(new BusinessSegment(1L, SEGMENT_TYPE.TYPE_004.name(), DateTimeUtility.parse("2018-02-07 00:00:00", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS), DateTimeUtility.parse("2018-02-09 23:59:59", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS)));
list.add(new BusinessSegment(1L, SEGMENT_TYPE.TYPE_005.name(), DateTimeUtility.parse("2018-02-08 00:00:00", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS), DateTimeUtility.parse("2018-02-08 23:59:59", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS)));
list.add(new BusinessSegment(1L, SEGMENT_TYPE.TYPE_006.name(), DateTimeUtility.parse("2018-02-05 00:00:00", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS), DateTimeUtility.parse("2018-02-19 23:59:59", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS)));
list.add(new BusinessSegment(1L, SEGMENT_TYPE.TYPE_007.name(), DateTimeUtility.parse("2018-02-20 00:00:00", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS), DateTimeUtility.parse("2018-02-22 23:59:59", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS)));
list.add(new BusinessSegment(1L, SEGMENT_TYPE.TYPE_008.name(), DateTimeUtility.parse("2018-02-21 00:00:00", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS), DateTimeUtility.parse("2018-02-23 23:59:59", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS)));
list.add(new BusinessSegment(1L, SEGMENT_TYPE.TYPE_009.name(), DateTimeUtility.parse("2018-02-22 00:00:00", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS), DateTimeUtility.parse("2018-02-24 23:59:59", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS)));
list.add(new BusinessSegment(1L, SEGMENT_TYPE.TYPE_010.name(), DateTimeUtility.parse("2018-02-23 00:00:00", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS), DateTimeUtility.parse("2018-02-25 23:59:59", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS)));
list.add(new BusinessSegment(1L, SEGMENT_TYPE.TYPE_010.name(), DateTimeUtility.parse("2018-02-25 00:00:00", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS), DateTimeUtility.parse("2018-02-28 23:59:59", DATE_TIME.FORMAT_YYYY_MM_DD_HH_MM_SS)));
Coordinate<BusinessSegment, Long> coordinate = new IntegerCoordinate(list);
coordinate.draw();
coordinate.section();
Map<Segment<Long>, List<BusinessSegment>> map = coordinate.aggregation();
for (Segment segment : coordinate.getSegments()) {
System.out.print(DateTimeUtility.getFormatTime((Long) segment.getStart().getPoint(), DATE_TIME.FORMAT_YYYY_MM_DD) + "-");
System.out.println(DateTimeUtility.getFormatTime((Long) segment.getEnd().getPoint(), DATE_TIME.FORMAT_YYYY_MM_DD));
System.out.println(map.get(segment));
}
}
}
示例运行结果
2018-02-05->2018-02-05
[cat-record{id=1, type='TYPE_001'} 2018-02-05-2018-02-11, cat-record{id=1, type='TYPE_006'} 2018-02-05-2018-02-19]
2018-02-06->2018-02-06
[cat-record{id=1, type='TYPE_001'} 2018-02-05-2018-02-11, cat-record{id=1, type='TYPE_002'} 2018-02-06-2018-02-10, cat-record{id=1, type='TYPE_006'} 2018-02-05-2018-02-19]
2018-02-07->2018-02-07
[cat-record{id=1, type='TYPE_001'} 2018-02-05-2018-02-11, cat-record{id=1, type='TYPE_002'} 2018-02-06-2018-02-10, cat-record{id=1, type='TYPE_004'} 2018-02-07-2018-02-09, cat-record{id=1, type='TYPE_006'} 2018-02-05-2018-02-19]
2018-02-08->2018-02-08
[cat-record{id=1, type='TYPE_001'} 2018-02-05-2018-02-11, cat-record{id=1, type='TYPE_002'} 2018-02-06-2018-02-10, cat-record{id=1, type='TYPE_004'} 2018-02-07-2018-02-09, cat-record{id=1, type='TYPE_005'} 2018-02-08-2018-02-08, cat-record{id=1, type='TYPE_006'} 2018-02-05-2018-02-19]
2018-02-09->2018-02-09
[cat-record{id=1, type='TYPE_001'} 2018-02-05-2018-02-11, cat-record{id=1, type='TYPE_002'} 2018-02-06-2018-02-10, cat-record{id=1, type='TYPE_004'} 2018-02-07-2018-02-09, cat-record{id=1, type='TYPE_006'} 2018-02-05-2018-02-19]
2018-02-10->2018-02-10
[cat-record{id=1, type='TYPE_001'} 2018-02-05-2018-02-11, cat-record{id=1, type='TYPE_002'} 2018-02-06-2018-02-10, cat-record{id=1, type='TYPE_006'} 2018-02-05-2018-02-19]
2018-02-11->2018-02-11
[cat-record{id=1, type='TYPE_001'} 2018-02-05-2018-02-11, cat-record{id=1, type='TYPE_006'} 2018-02-05-2018-02-19]
2018-02-12->2018-02-19
[cat-record{id=1, type='TYPE_006'} 2018-02-05-2018-02-19]
2018-02-21->2018-02-21
[cat-record{id=1, type='TYPE_007'} 2018-02-20-2018-02-22, cat-record{id=1, type='TYPE_008'} 2018-02-21-2018-02-23]
2018-02-22->2018-02-22
[cat-record{id=1, type='TYPE_007'} 2018-02-20-2018-02-22, cat-record{id=1, type='TYPE_008'} 2018-02-21-2018-02-23, cat-record{id=1, type='TYPE_009'} 2018-02-22-2018-02-24]
2018-02-24->2018-02-24
[cat-record{id=1, type='TYPE_009'} 2018-02-22-2018-02-24, cat-record{id=1, type='TYPE_010'} 2018-02-23-2018-02-25]
2018-02-26->2018-02-28
[cat-record{id=1, type='TYPE_010'} 2018-02-25-2018-02-28]
完整示例代码下载 https://github.com/sparrowzoo/sparrow
sparrow-test项目下的
com.sparrow.facade.segmen.Main方法
相关推荐
1、文件内容:abrt-devel-2.1.11-60.el7.centos.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/abrt-devel-2.1.11-60.el7.centos.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、安装指导:私信博主,全程指导安装
房地产公司绩效管理办法(精品)
网卡驱动-r8169-linux-官方驱动,能翻墙的也可以去外网下,这里只是赚个积分,本人有时候也需要下载别人的资源,望理解,外网地址:https://www.realtek.com/Download/ToDownload?type=direct&downloadid=3378
基于非线性干扰观测器的自适应滑模反演控制策略在机械臂模型中的应用:神经网络MATLAB仿真研究,(文献+程序)基于非线性干扰观测器的自适应滑模反演控制 机械臂模型 神经网络 matlab仿真 滑膜 带原班文献 ,关键词:非线性干扰观测器; 自适应滑模反演控制; 机械臂模型; 神经网络; MATLAB仿真; 滑膜控制; 原班文献,基于非线性干扰观测器的机械臂自适应滑模反演控制:matlab神经网络仿真及原班文献解读
"电力电子方向入门学习:单相PWM整流无桥图腾柱pfc技术Simulink仿真实践,电压调控及优化性能探索",单相PWM整流无桥图腾柱pfc,simulink仿真 输入电压220v有效值 输出电压500v纹波在1%以内 功率因数为1 电流THD<5% 开关频率20k 可作为电力电子方向入门学习~~ ,关键词:单相PWM整流;无桥图腾柱PFC;Simulink仿真;输入电压220V;输出电压500V;纹波;功率因数1;电流THD<5%;开关频率20k;电力电子方向入门学习。,"单相PWM整流桥技术:无桥图腾柱PFC的Simulink仿真入门学习"
员工晋升申请表
项目已获导师指导并通过的高分毕业设计项目,可作为课程设计和期末大作业,下载即用无需修改,项目完整确保可以运行。 包含:项目源码、数据库脚本、软件工具等,该项目可以作为毕设、课程设计使用,前后端代码都在里面。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。 项目都经过严格调试,确保可以运行!可以放心下载 技术组成 语言:java 开发环境:idea 数据库:MySql8.0 部署环境:Tomcat(建议用 7.x 或者 8.x 版本),maven 数据库工具:navicat
FPGA实现CameraLink相机Base模式解码与HDMI高清视频输出方案,FPGA采集CameraLink相机Base模式 本文详细描述了FPGA采集CameraLink相机Base模式解码输出的实现设计方案,思路是这样的,CameraLink相机输入到FPGA板子,FPGA使用内部逻辑资源实现LVDS视频解码,解析出像素时钟、行同步信号、场同步信号、数据有效信号、以及像素数据,然后将视频转为Xilinx的AXI4-Sream的视频流,经VDMA送入DDR3缓存,然后读取出视频再经过AXI4-Sream to Video Out通过HDMI接口输出视频,这是Xilinx图像处理常用的套路,可谓相当精巧的方案 ,核心关键词:FPGA; CameraLink相机; Base模式; LVDS视频解码; 像素时钟; 同步信号; 像素数据; Xilinx AXI4-Sream; VDMA; DDR3缓存; HDMI接口视频输出。,"FPGA实现CameraLink相机Base模式视频解码与输出设计"
各岗位职责及操作
内容概要:本文介绍了稳定视频人脸修复(Stable Video Face Restoration, SVFR)方法,这是一个为解决一般化视频人脸修复(Generalized Video Face Restoration, GVFR)而设计的统一框架。作者针对现有技术未能有效处理时间一致性和运动伪影的问题提出SVFR方法,并通过实验展示其相较于单任务模型,在盲脸修复、颜色化和修补方面的性能显著提升。GVFR整合了三种子任务(BFR, colorization, 和 inpainting),并通过联合框架提高了训练效果,利用了预训练稳定视频扩散模型(SVD)。文中还引入了统一面部修复框架来确保跨子任务的一致特征表征,并提出了一种新的面部先验损失函数,通过面部特征点辅助修复过程并提高稳定性。 适用人群:适用于从事计算机视觉特别是视频识别和图像处理的研究者和技术工程师。 使用场景及目标:①用于高质量的人脸恢复,特别是在老旧电影或低质量监控录像等场合;②增强人脸识别准确性,确保长时间视频中身份一致性;③应用于需要真实感强的画面处理环境如在线会议直播。 其他说明:这项工作中提出的SVFR不仅解决了当前的技术难题,还为未来相关领域的研究和发展提供了重要参考价值,尤其体现在它所建立的新范例上,即如何通过多任务监督从有限数据集中获得更好的表现。
2025年义务教育新课程标准生物(2022年版)必考试题含答案.docx
直播带货销售业绩表
内容概要:本文详细记录了一个完整的基于Hadoop平台的WordCount任务实现过程,从环境准备到最终成果展示,涵盖了关键步骤的具体操作流程。首先介绍了创建所需文件夹结构并上传原始文本文件至HDFS;其次详述了构建Maven项目来组织相关源代码,以及定义Map(映射)、Combine(组合)、Reduce(归约)三个重要的处理环节所对应的程序逻辑;然后阐述了项目打包、分发过程及远程节点上部署运行该作业的整体思路;最后,通过访问Web界面确认最终生成的统计报告保存路径及其部分内容,验证任务成功完成。 适用人群:适用于初学者及有一定经验的数据工程师或研究人员,特别是那些希望快速掌握MapReduce模型实际应用技巧的人士。 使用场景及目标:此教程可以帮助用户深入了解Apache Hadoop生态系统内的MapReduce计算范式的运作机制。它演示了如何借助命令行工具高效管理和查询大规模非结构化或半结构化的数据集,从而支持后续更加复杂的分析任务的需求探索。此外,对于正在寻找入门级实战演练的学习者而言,这也是非常有价值的练习资料,既包括理论概念的学习也提供了充分的机会来进行动手实验。 其他说明:为了确保最佳实践效果,请注意跟随文中指引逐步尝试每一个新概念的应用,尤其是在编码部分,尽量不要跳过任何一步骤,并积极查阅官方文档或其他权威参考资料作为补充材料,遇到困难时也不必气馁,多做几次重复试验往往能带来意外收获。同时考虑到性能优化的可能性,可以在适当时候调整配置参数,比如增大堆栈容量或者更改块副本数目等。
2025义务教育历史新课程标准(2022版)必考题库含答案.docx
显示效果视频
员工晋升管理规定
2025年义务教育英语课程标准(2022版)必考题库及答案.docx
项目已获导师指导并通过的高分毕业设计项目,可作为课程设计和期末大作业,下载即用无需修改,项目完整确保可以运行。 包含:项目源码、数据库脚本、软件工具等,该项目可以作为毕设、课程设计使用,前后端代码都在里面。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。 项目都经过严格调试,确保可以运行!可以放心下载 技术组成 语言:java 开发环境:idea 数据库:MySql8.0 部署环境:Tomcat(建议用 7.x 或者 8.x 版本),maven 数据库工具:navicat
风储联合系统:直驱风机与储能技术的完美融合,创新能源存储解决方案,风储联合系统 直驱风机加储能系统 ,核心关键词:风储联合系统; 直驱风机; 储能系统; 联合系统。,"风储联动:直驱风机与储能系统的绿色能源集成"
双馈风力发电机模型研究:Simulink中的完美波形效果展示,涵盖DFIG模型对风速变化与电流电压特性的精准模拟。,双馈风力发电机模型研究(DFIG),simulink模型。 给定风速变化,电流与电压等波形效果完美。 ,核心关键词:双馈风力发电机模型研究(DFIG); Simulink模型; 风速变化; 电流波形; 电压波形; 效果完美。,"双馈风力发电机Simulink模型研究:风速变化下的电流电压波形优化"