當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。