当前位置: 首页>>代码示例>>Python>>正文


Python vgg16.VGG16属性代码示例

本文整理汇总了Python中vgg16.VGG16属性的典型用法代码示例。如果您正苦于以下问题:Python vgg16.VGG16属性的具体用法?Python vgg16.VGG16怎么用?Python vgg16.VGG16使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在vgg16的用法示例。


在下文中一共展示了vgg16.VGG16属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_encoding_model

# 需要导入模块: import vgg16 [as 别名]
# 或者: from vgg16 import VGG16 [as 别名]
def load_encoding_model():
	model = VGG16(weights='imagenet', include_top=True, input_shape = (224, 224, 3))
	return model 
开发者ID:anuragmishracse,项目名称:caption_generator,代码行数:5,代码来源:prepare_dataset.py

示例2: create_model

# 需要导入模块: import vgg16 [as 别名]
# 或者: from vgg16 import VGG16 [as 别名]
def create_model(self, ret_model = False):
        #base_model = VGG16(weights='imagenet', include_top=False, input_shape = (224, 224, 3))
        #base_model.trainable=False
        image_model = Sequential()
        #image_model.add(base_model)
        #image_model.add(Flatten())
        image_model.add(Dense(EMBEDDING_DIM, input_dim = 4096, activation='relu'))

        image_model.add(RepeatVector(self.max_cap_len))

        lang_model = Sequential()
        lang_model.add(Embedding(self.vocab_size, 256, input_length=self.max_cap_len))
        lang_model.add(LSTM(256,return_sequences=True))
        lang_model.add(TimeDistributed(Dense(EMBEDDING_DIM)))

        model = Sequential()
        model.add(Merge([image_model, lang_model], mode='concat'))
        model.add(LSTM(1000,return_sequences=False))
        model.add(Dense(self.vocab_size))
        model.add(Activation('softmax'))

        print "Model created!"

        if(ret_model==True):
            return model

        model.compile(loss='categorical_crossentropy', optimizer='rmsprop', metrics=['accuracy'])
        return model 
开发者ID:anuragmishracse,项目名称:caption_generator,代码行数:30,代码来源:caption_generator.py

示例3: run

# 需要导入模块: import vgg16 [as 别名]
# 或者: from vgg16 import VGG16 [as 别名]
def run(self):
		global label
		# Load the VGG16 network
		print("[INFO] loading network...")
		self.model = VGG16(weights="imagenet")

		while (~(frame is None)):
			(inID, label) = self.predict(frame) 
开发者ID:ChunML,项目名称:DeepLearning,代码行数:10,代码来源:camera_test.py

示例4: __init__

# 需要导入模块: import vgg16 [as 别名]
# 或者: from vgg16 import VGG16 [as 别名]
def __init__(self):
        super(RPN, self).__init__()

        self.features = VGG16(bn=False)
        self.conv1 = Conv2d(512, 512, 3, same_padding=True)
        self.score_conv = Conv2d(512, len(self.anchor_scales) * 3 * 2, 1, relu=False, same_padding=False)
        self.bbox_conv = Conv2d(512, len(self.anchor_scales) * 3 * 4, 1, relu=False, same_padding=False)

        # loss
        self.cross_entropy = None
        self.los_box = None 
开发者ID:longcw,项目名称:faster_rcnn_pytorch,代码行数:13,代码来源:faster_rcnn.py

示例5: model_gen

# 需要导入模块: import vgg16 [as 别名]
# 或者: from vgg16 import VGG16 [as 别名]
def model_gen():
	model = VGG16(weights='imagenet', include_top=True, input_shape = (224, 224, 3))
	return model 
开发者ID:Shobhit20,项目名称:Image-Captioning,代码行数:5,代码来源:encode_image.py

示例6: encode_image

# 需要导入模块: import vgg16 [as 别名]
# 或者: from vgg16 import VGG16 [as 别名]
def encode_image():
	model = VGG16(weights='imagenet', include_top=True, input_shape = (224, 224, 3))
	image_encodings = {}
	
	train_imgs_id = open("Flickr8K_Text/Flickr_8k.trainImages.txt").read().split('\n')[:-1]
	print len(train_imgs_id)
	test_imgs_id = open("Flickr8K_Text/Flickr_8k.testImages.txt").read().split('\n')[:-1]
	images = []
	images.extend(train_imgs_id)
	images.extend(test_imgs_id)
	print len(images)
	bar = progressbar.ProgressBar(maxval=len(images), \
    		widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()])
	bar.start()
	counter=1
	print "Encoding images"

	for img in images:
		path = "Flickr8K_Data/"+str(img)
		image_encodings[img] = encodings(model, path)
		bar.update(counter)
		counter += 1

	bar.finish()
	with open( "image_encodings.p", "wb" ) as pickle_f:
		pickle.dump( image_encodings, pickle_f )
	print "Encodings dumped into image_encodings.p" 
开发者ID:Shobhit20,项目名称:Image-Captioning,代码行数:29,代码来源:encode_image.py


注:本文中的vgg16.VGG16属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。