试图在图像上制作响应三角形,但它没有调整大小,并且根本没有对齐。如何解决?
from sequenceGenerator import train_seq_genenrator, test_seq_generator
history = new_model.fit_generator(train_seq_genenrator()
, steps_per_epoch=num_train_samples // batch_size
, validation_data=test_seq_generator()
, validation_steps=num_test_samples // batch_size
, epochs=epochs
, shuffle=False)
-----------------
AttributeError Traceback (most recent call last)
<ipython-input-22-ad1d08859faf> in <module>()
4 , validation_steps=num_test_samples // batch_size
5 , epochs=epochs
----> 6 , shuffle=False)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
1424 use_multiprocessing=use_multiprocessing,
1425 shuffle=shuffle,
-> 1426 initial_epoch=initial_epoch)
1427
1428 def evaluate_generator(self,
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training_generator.py in model_iteration(model, data, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch, mode, batch_size, **kwargs)
113 batch_size=batch_size,
114 epochs=epochs - initial_epoch,
--> 115 shuffle=shuffle)
116
117 do_validation = validation_data is not None
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training_generator.py in convert_to_generator_like(data, batch_size, steps_per_epoch, epochs, shuffle)
375
376 # Create generator from NumPy or EagerTensor Input.
--> 377 num_samples = int(nest.flatten(data)[0].shape[0])
378 if batch_size is None:
379 raise ValueError('You must specify `batch_size`')
AttributeError: 'SequenceGenerator' object has no attribute 'shape'
答案 0 :(得分:1)
首先使用bootstrap position将position:relative
添加到父项(在您的情况下为.image
)
第二次将bootstrap-4 classes
用作.image/img
的{{3}}
.image:after {
content: '';
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-bottom: 20px solid #f5f5f5;
position: absolute;
left: 45%;
top: 63%;
transform: translatex(-50%);
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<div class="image w-100 position-relative">
<img src="https://i.stack.imgur.com/vdzwt.jpg" class="img-fluid w-100">
</div>