我正在研究GAN我已经完成了一门课程,它给了我一个程序的例子,该程序根据输入的例子生成图像.
这个例子可以在这里找到:
https://github.com/davidsonmizael/gan
Run Code Online (Sandbox Code Playgroud)
所以我决定使用它来生成基于面部正面照片数据集的新图像,但我没有取得任何成功.与上面的示例不同,代码仅生成噪声,而输入具有实际图像.
实际上我没有任何关于我应该改变什么以使代码指向正确方向并从图像中学习的线索.我没有更改示例中提供的代码的单个值,但它不起作用.
如果有人能帮助我理解这一点,并指出我正确的方向将是非常有帮助的.提前致谢.
我的判断者:
class D(nn.Module):
def __init__(self):
super(D, self).__init__()
self.main = nn.Sequential(
nn.Conv2d(3, 64, 4, 2, 1, bias = False),
nn.LeakyReLU(0.2, inplace = True),
nn.Conv2d(64, 128, 4, 2, 1, bias = False),
nn.BatchNorm2d(128),
nn.LeakyReLU(0.2, inplace = True),
nn.Conv2d(128, 256, 4, 2, 1, bias = False),
nn.BatchNorm2d(256),
nn.LeakyReLU(0.2, inplace = True),
nn.Conv2d(256, 512, 4, 2, 1, bias = False),
nn.BatchNorm2d(512),
nn.LeakyReLU(0.2, inplace = True),
nn.Conv2d(512, 1, 4, 1, 0, bias = False),
nn.Sigmoid()
)
def forward(self, input): …
Run Code Online (Sandbox Code Playgroud) 我正在用HTML和Javascript做一个项目,它将使用本地文件运行本地.我需要通过输入选择一个文件,获取它的信息然后决定我是否会添加到我的列表中并重现.如果我决定使用它,我将不得不把它放在队列中以便以后使用.否则我只会丢弃并选择另一个文件.
我面临的问题是,我无法通过在输入上选择它来找到获得vídeo持续时间的方法.
我搜索了很多,但没有找到任何方法来获得持续时间.在下面的代码中,我尝试使用' file.duration '但不起作用,它只返回' undefined '.
这是我的意见,你可以看到正常.
<div id="input-upload-file" class="box-shadow">
<span>upload! (?????)</span> <!--ignore the text face lol -->
<input type="file" class="upload" id="fileUp" name="fileUpload" onchange="setFileInfo()">
</div>
Run Code Online (Sandbox Code Playgroud)
这就是我用来获取所有信息的功能.
function setFileInfo(){
showInfo(); //change div content
var file = document.getElementById("fileUp").files[0];
var pid = 1;
var Pname = file.name;
Pname = Pname.slice(0, Pname.indexOf(".")); //get filename without extension
var Ptype = file.type;
var Psize = bytesToSize(file.size); //turns into KB,MB, etc...
var Pprior = setPriority(Ptype); //returns 1, 2 or 3
var Pdur = file.duration;
var Pmem …
Run Code Online (Sandbox Code Playgroud) 我如何使用 aHashMap<String, Object>
作为对象的源?
这是我的目标对象:
public class ComponentStyleDTO{
private String attribute;
private Object value;
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用我发现的这种方法,这也在文档中,但对我来说失败了。
我的映射器:
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE, componentModel = "spring", uses = ComponentStyleMapperUtil.class)
public interface ComponentStyleMapper {
ComponentStyleMapper MAPPER = Mappers.getMapper(ComponentStyleMapper.class);
@Mappings({@Mapping(target = "attribute", qualifiedBy = ComponentStyleMapperUtil.Attribute.class),
@Mapping(target = "value", qualifiedBy = ComponentStyleMapperUtil.Value.class)})
ComponentStyleDTO hashMapToComponentStyleDTO(HashMap<String, Object> hashMap);
}
Run Code Online (Sandbox Code Playgroud)
我的实用程序:
public class ComponentStyleMapperUtil{
@Qualifier
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface Attribute {
}
@Qualifier
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface Value {
}
@Attribute
public String attribute(HashMap<String, Object> in){ …
Run Code Online (Sandbox Code Playgroud) 我正在使用maven将此应用程序从weblogic移植到Jboss,我现在正在第二页面对此消息.我知道自己可能缺少什么吗?
它不适用于我创建的任何JSP或我称之为的任何控制器.我试图创建一个PrintWriter的实例,它输出String.问题是通过这个函数编译任何jsp.此外,index.jsp工作正常.
server.log中的Stacktrace:
ESC[0mESC[31m09:51:38,753 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cashvariance].[jsp]] (http-/0.0.0.0:8180-1) JBWEB
000236: Servlet.service() for servlet jsp threw exception: java.lang.NullPointerException
at java.io.Writer.write(Writer.java:157) [rt.jar:1.8.0_101]
at java.io.PrintWriter.newLine(PrintWriter.java:480) [rt.jar:1.8.0_101]
at java.io.PrintWriter.println(PrintWriter.java:629) [rt.jar:1.8.0_101]
at java.io.PrintWriter.println(PrintWriter.java:740) [rt.jar:1.8.0_101]
at org.apache.jasper.compiler.ServletWriter.printil(ServletWriter.java:130) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.compiler.Generator.genPreamblePackage(Generator.java:481) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.compiler.Generator.generatePreamble(Generator.java:584) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.compiler.Generator.generate(Generator.java:3462) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:359) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:339) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:326) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:606) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:309) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:242) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-2.jar:1.0.2.Final-redhat-2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at …
Run Code Online (Sandbox Code Playgroud) 如何将 dict_item 保存到 json 文件以将其加载到另一个地方?我在浏览器中使用 js 获取列表并返回到 python,但我无法将其保存为 Json 文件,因为它说:
'dict_items' 类型的对象不是 JSON 可序列化的
var items = {}, ls = window.localStorage;
for (var i = 0, k; i < ls.length; i++)
items[k = ls.key(i)] = ls.getItem(k);
return items;
Run Code Online (Sandbox Code Playgroud)
Traceback (most recent call last):
File "tester.py", line 9, in <module>
obj.store()
File "F:\project\zw\zwp.py", line 69, in store
json.dump(session_ls, fp)
File "c:\users\dkun\appdata\local\programs\python\python36\Lib\json\__init__.py", line 179, in dump
for chunk in iterable:
File "c:\users\dkun\appdata\local\programs\python\python36\Lib\json\encoder.py", line 437, in _iterencode
o = _default(o) …
Run Code Online (Sandbox Code Playgroud) 我正在使用以下网址搜索带有标记的帖子,该网址返回带有所有最新帖子的Json,但它只返回用户ID,而不是用户名.
https://www.instagram.com/explore/tags/neymar/?__a=1
我想知道是否有办法在不使用官方API和传递用户ID的情况下检索Instagram个人资料的用户名.